TUT Reference
Data-Driven Documentation Generator
What is TUT?
TUT is a data-driven documentation generator that converts JSON definitions into HTML documentation. It supports two document types: guides (step-by-step tutorials) and reference docs (scrollable topic-based documentation).
Guide
Step-by-step interactive tutorials with terminal simulation
Reference
Scrollable topic-based docs with sidebar navigation
Quick Start
Get started generating documentation in seconds.
# List available sources
tut get sources
# Build a document
tut build my-ref
# Generate landing page
tut index
# Preview in browser
tut serve
Environment
TUT uses two environment variables for paths.
| Variable | Purpose | Example |
|---|---|---|
| TUT_SRC | Source files (JSON, templates) | $TETRA_SRC/bash/tut |
| TUT_DIR | Output directory | $TETRA_DIR/tut |
Run tut doctor to verify your environment is configured correctly.
tut build
Build documentation from JSON source files.
tut build [--type guide|reference] [--no-bump] [--all]
Builds HTML documentation from a JSON source file. Type is auto-detected from JSON structure.
Parameters
namestring- Source name (without .json extension)
--typestring- Force document type (guide or reference)
--no-bumpflag- Skip version bump prompt
--allflag- Build all sources in available/
Returns
file - Generated HTML in $TUT_DIR/generated/
Example
tut build nh-ref --no-bump
tut init
Create a new document from template.
tut init [--type guide|reference]
Creates a new JSON template in the available/ directory.
Parameters
namestring- Document name (becomes filename)
--typestring- Document type (default:
reference)
Example
tut init my-project-ref --type reference
tut serve
Start a local server and preview documentation.
tut serve [file] [--port N] [--stop] [--status]
Starts an HTTP server via TSM and opens the browser. Uses the tut service for process management.
Parameters
filestring- Specific file to open in browser
--portnumber- Server port (default: auto-assigned)
--stopflag- Stop the server
--statusflag- Show server status
Example
tut serve tut-reference.html
tut index
Generate a landing page for all documents.
tut index
Scans $TUT_DIR/generated/ for HTML files and creates an index.html landing page with cards linking to each document.
Example
tut index
The index page extracts metadata (title, version, type) from each document's meta tags and displays them in a card grid.
tut get
Query sources and generated documents.
tut get sourcesList JSON files in available/tut get docsList generated HTML files with metadatatut get recordingsList terminal recordings (.cast files)
Other Commands
tut validateValidate JSON against schematut doctorCheck environment and pathstut typesOverview of document typestut types guideGuide schema and structuretut types referenceReference schema and structuretut helpShow help
paragraph
Simple text block.
{
"type": "paragraph",
"text": "Your text content here."
}
command-list
List of commands with descriptions. Ideal for CLI reference.
{
"type": "command-list",
"commands": [
{ "code": "cmd arg", "description": "What it does" },
{ "code": "cmd --flag", "description": "Another command" }
]
}
Renders as:
cmd argWhat it doescmd --flagAnother command
code-block
Fenced code with optional language. Click-to-copy is automatic.
{
"type": "code-block",
"language": "bash",
"code": "echo 'Hello World'"
}
module-grid
Grid of cards for displaying modules, features, or options.
{
"type": "module-grid",
"modules": [
{ "name": "Module A", "description": "Does X" },
{ "name": "Module B", "description": "Does Y" }
]
}
Renders as:
Module A
Does X
Module B
Does Y
list
Ordered or unordered list.
{
"type": "list",
"ordered": false,
"items": ["First item", "Second item", "Third item"]
}
table
Data table with headers and rows.
{
"type": "table",
"headers": ["Name", "Type", "Description"],
"rows": [
["id", "string", "Unique identifier"],
["title", "string", "Display title"]
]
}
Renders as:
| Name | Type | Description |
|---|---|---|
| id | string | Unique identifier |
| title | string | Display title |
api-endpoint
REST API endpoint documentation with method, path, parameters, and responses.
/api/users
Create a new user account
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
email | string | required | User email address |
name | string | required | Display name |
Request Body
{
"email": "user@example.com",
"name": "John Doe"
}
Responses
api-function
Function/method documentation with signature, parameters, returns, and example.
_tut_build [--type] [--no-bump]
Internal function that builds a single document.
Parameters
namestring- Source file name
--typestring- Force guide or reference
--no-bumpflag- Skip version prompt
Returns
file - HTML file in generated/
Example
_tut_build nh-ref --no-bump
Reference Structure
Reference documents are organized into groups containing topics.
{
"metadata": {
"title": "My Docs",
"tagline": "Optional subtitle",
"version": "1.0.0"
},
"groups": [
{
"id": "getting-started",
"title": "Getting Started",
"topics": [
{
"id": "install",
"title": "Installation",
"description": "How to install...",
"content": [ ... ]
}
]
}
]
}
Guide Structure
Guides are linear step-by-step tutorials with terminal simulation.
{
"metadata": {
"title": "My Guide",
"difficulty": "beginner",
"estimatedTime": 15
},
"steps": [
{
"id": "step-1",
"title": "Step 1",
"content": [ ... ],
"terminal": [
{ "type": "prompt", "content": "$ " },
{ "type": "command", "content": "echo hello" },
{ "type": "output", "content": "hello" }
]
}
]
}
File Organization
| Path | Purpose |
|---|---|
| $TUT_SRC/tut.sh | Main CLI entry point |
| $TUT_SRC/includes.sh | Module loader |
| $TUT_SRC/tut_reference.sh | Reference doc renderer |
| $TUT_SRC/tut_complete.sh | Tab completion |
| $TUT_SRC/core/output.sh | Output helpers (colors, formatting) |
| $TUT_SRC/core/validators.sh | JSON validation |
| $TUT_SRC/renderers/html.sh | Guide HTML renderer |
| $TUT_SRC/templates/ | HTML/CSS/JS templates |
| $TUT_SRC/available/ | Source JSON files |
| $TUT_DIR/generated/ | Output HTML files |
Design Tokens
TUT uses CSS custom properties for theming. Access the design token editor by adding ?design=true to any document URL.
| Token | Default | Purpose |
|---|---|---|
| --bg-primary | #1a1a2e | Page background |
| --bg-secondary | #16213e | Sections, sidebar |
| --bg-tertiary | #0d1b2a | Code blocks, cards |
| --text-title | #eaeaea | Titles, headings |
| --text-primary | #c0c0d0 | Body text |
| --text-secondary | #8a8aa0 | Muted text |
| --text-code | #ff6b6b | Code block text |
| --accent-primary | #e94560 | Links, highlights |
| --border | #2a2a4a | Borders, dividers |
Design Token Editor
The FAB (Floating Action Button) provides real-time theme editing.
- Add ?design=true to any document URL to enable
- Click the FAB to open the design panel
- Edit colors, fonts, and section styles
- Export theme as tokens.json file
- Import themes from file or localStorage
- Copy CSS variables to clipboard
Themes are saved to localStorage and persist across sessions.
Google Fonts
Add custom fonts by pasting the Google Fonts embed code.
- Go to fonts.google.com and select fonts
- Click 'Get embed code'
- Paste the full embed code into the font input
- Multi-font suites are supported
- Mono fonts auto-assign to Code, sans fonts to Heading/Body