Skip to content

Commit abf100f

Browse files
- Enhance documentation with titles and descriptions for various pages using YAML frontmatter.
- Introduce a custom build system for generating llms.txt and llms-full.txt from documentation files. - Add openapi.json to .gitignore to prevent it from being tracked. - Remove outdated llms.txt file as it is now generated dynamically. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 1ad2a18 commit abf100f

45 files changed

Lines changed: 544 additions & 62 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ uv.lock
2626
/src/dstack/_internal/server/statics
2727

2828
profiling_results.html
29+
docs/docs/reference/api/rest/openapi.json

contributing/DOCS.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,106 @@ If you want to build static files, you can use the following command:
4747
```shell
4848
uv run mkdocs build -s
4949
```
50+
51+
## Documentation build system
52+
53+
The documentation uses a custom build system with MkDocs hooks to generate various files dynamically.
54+
55+
### Build hooks
56+
57+
The build process is customized via hooks in `scripts/docs/hooks.py`:
58+
59+
#### 1. Example materialization
60+
61+
Example pages like `examples/single-node-training/trl/index.md` are stubs that reference `README.md` files in the repository root:
62+
- **Stub location**: `docs/examples/single-node-training/trl/index.md`
63+
- **Content source**: `examples/single-node-training/trl/README.md`
64+
65+
During the build, the hook reads the README content and uses it for rendering the HTML page.
66+
67+
#### 2. Schema reference expansion
68+
69+
Files in `docs/reference/**/*.md` can use `#SCHEMA#` placeholders that are expanded with generated schema documentation during the build.
70+
71+
#### 3. llms.txt generation
72+
73+
Two files are generated for LLM consumption:
74+
75+
- **llms.txt**: Structured overview of documentation with titles and descriptions
76+
- Generated from mkdocs nav structure
77+
- Includes sections: Getting started, Concepts, Guides, Examples
78+
- Excludes: Reference section
79+
- Configuration: `scripts/docs/gen_llms_files.py` (INCLUDE_SECTIONS, EXCLUDE_SECTIONS)
80+
81+
- **llms-full.txt**: Full concatenation of all pages from llms.txt
82+
- Contains complete markdown content of all included pages
83+
84+
The generation logic is in `scripts/docs/gen_llms_files.py` and uses:
85+
- `site_name`, `site_description`, `site_url` from `mkdocs.yml`
86+
- Page titles from mkdocs nav structure
87+
- Page descriptions from markdown frontmatter
88+
89+
**Adding descriptions**: To add descriptions to pages, add YAML frontmatter:
90+
91+
```yaml
92+
---
93+
title: Page Title
94+
description: Short description of what this page covers
95+
---
96+
```
97+
98+
For examples, add frontmatter to the `README.md` files in the repository root (e.g., `examples/single-node-training/trl/README.md`).
99+
100+
#### 4. Skills discovery
101+
102+
The build creates `.well-known/skills/` directory structure for skills discovery:
103+
- Reads `skills/dstack/SKILL.md`
104+
- Parses name and description from frontmatter
105+
- Generates `.well-known/skills/index.json`
106+
- Copies SKILL.md to both `.well-known/skills/dstack/` and site root
107+
108+
### File structure
109+
110+
```
111+
docs/
112+
├── docs/ # Main documentation content
113+
│ ├── index.md # Getting started
114+
│ ├── installation.md
115+
│ ├── quickstart.md
116+
│ ├── concepts/ # Concept pages
117+
│ ├── guides/ # How-to guides
118+
│ └── reference/ # API reference (schema expansion)
119+
├── examples/ # Example stub files (index.md)
120+
│ └── single-node-training/
121+
│ └── trl/
122+
│ └── index.md # Stub referencing root README
123+
└── overrides/ # Theme customization
124+
125+
examples/ # Example content (repository root)
126+
└── single-node-training/
127+
└── trl/
128+
├── README.md # Actual content with frontmatter
129+
└── train.dstack.yml
130+
131+
scripts/docs/
132+
├── hooks.py # MkDocs build hooks
133+
├── gen_llms_files.py # llms.txt generation
134+
├── gen_schema_reference.py # Schema expansion
135+
└── gen_cli_reference.py # CLI reference generation
136+
137+
skills/
138+
└── dstack/
139+
└── SKILL.md # Skills discovery content
140+
```
141+
142+
### Testing changes
143+
144+
When modifying the build system:
145+
146+
1. Test local build: `uv run mkdocs build -s`
147+
2. Check generated files in `site/`:
148+
- `site/llms.txt`
149+
- `site/llms-full.txt`
150+
- `site/.well-known/skills/index.json`
151+
3. Verify example pages render correctly
152+
4. Check that descriptions appear in llms.txt

docs/docs/concepts/backends.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Backends
3+
description: Configuring cloud providers and Kubernetes clusters
4+
---
5+
16
# Backends
27

38
Backends allow `dstack` to provision fleets across GPU clouds or Kubernetes clusters.

docs/docs/concepts/dev-environments.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Dev environments
3+
description: Provisioning remote instances for cloud-based development
4+
---
5+
16
# Dev environments
27

38
A dev environment lets you provision an instance and access it with your desktop IDE.

docs/docs/concepts/events.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Events
3+
description: Auditing resource state changes and operations
4+
---
5+
16
# Events
27

38
Events provide a chronological record of notable state changes and operations affecting `dstack` resources. They are designed for auditing, debugging, and understanding the lifecycle of runs, jobs, fleets, and other resources.

docs/docs/concepts/fleets.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Fleets
3+
description: Managing pools of compute instances
4+
---
5+
16
# Fleets
27

38
Before submitting runs, you must create a fleet. Fleets act as both pools of instances and templates for how those instances are provisioned.

docs/docs/concepts/gateways.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Gateways
3+
description: Managing ingress traffic and endpoints for services
4+
---
5+
16
# Gateways
27

38
Gateways manage ingress traffic for running [services](services.md), handle auto-scaling and rate limits, enable HTTPS, and allow you to configure a custom domain. They also support custom routers, such as the [SGLang Model Gateway](https://docs.sglang.ai/advanced_features/router.html#).

docs/docs/concepts/metrics.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Metrics
3+
description: Tracking and monitoring system metrics
4+
---
5+
16
# Metrics
27

38
`dstack` automatically tracks essential metrics, which you can access via the CLI and UI.

docs/docs/concepts/projects.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Projects
3+
description: Organizing teams and isolating resources
4+
---
5+
16
# Projects
27

38
Projects enable the isolation of different teams and their resources. Each project can configure its own backends and

docs/docs/concepts/secrets.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Secrets
3+
description: Managing sensitive values and credentials
4+
---
5+
16
# Secrets
27

38
Secrets allow centralized management of sensitive values such as API keys and credentials. They are project-scoped, managed by project admins, and can be referenced in run configurations to pass sensitive values to runs in a secure manner.

0 commit comments

Comments
 (0)