Skip to content

Commit 87fbdcf

Browse files
authored
Merge pull request #1 from shellui-dev/feat/shelldocs-0.1.17-llms
feat: ShellDocs 0.1.17 with llms.txt for AI agents
2 parents cbeb960 + b78cfc8 commit 87fbdcf

28 files changed

Lines changed: 259 additions & 43 deletions

‎.github/workflows/deploy-pages.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
# use. Prevents a floating latest-prerelease install from silently
5959
# shifting the prerender behaviour under our feet mid-release-cycle.
6060
- name: Install shelldocs CLI
61-
run: dotnet tool install -g ShellDocs.CLI --version 0.1.15-alpha
61+
run: dotnet tool install -g ShellDocs.CLI --version 0.1.17-alpha
6262

6363
# Restore explicitly so the `shelldocs build`'s embedded `dotnet
6464
# publish` doesn't spend the first run downloading every package

‎Components/App.razor‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@
1212
<link rel="stylesheet" href="_content/ShellDocs.Tokens/tokens.css" />
1313
<link rel="stylesheet" href="_content/ShellDocs.Components/shelldocs-theme.css" />
1414
<link rel="stylesheet" href="ShellDocs.Site.styles.css" />
15-
@* ShellDocs 0.1.15 scopes this rule so it never matches, and an inline LogoSvg
16-
with no width of its own renders 0px wide. Remove once that is fixed upstream. *@
17-
<style>
18-
.brand-logo-svg > svg { height: 100%; width: auto; display: block; }
19-
</style>
2015
<script>
2116
(function () {
2217
var saved = null;

‎Components/Pages/Home.razor‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@
4646

4747
<SiteFooter />
4848

49-
@* HomeLayout has no search dialog of its own; this one makes Ctrl+K and the bento's search panel work here. *@
50-
<SearchDialog />
51-
5249
<style>
5350
.site-home {
5451
max-width: 68rem;

‎Llms/agent-rules.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## Rules for AI agents
2+
3+
Read these before building or changing a ShellDocs site.
4+
5+
1. **Install with the CLI.** `dotnet tool install -g ShellDocs.CLI --prerelease`, then `shelldocs init` for a new site or in an existing Blazor Web App. Keep the `ShellDocs.*` package versions and the CLI version the same.
6+
2. **Pages are Markdown files** in `content/docs/`, with `title` and `description` frontmatter. Each folder's `meta.json` sets the sidebar order and must list every page. `shelldocs add page|guide|component <name>` scaffolds one. New pages and `meta.json` edits need a restart of the running site.
7+
3. **Use ShellDocs' components in Markdown; don't write HTML look-alikes.** `<Callout>`, `<Tabs>` / `<Tab>`, `<Steps>` / `<Step>`, `<CardGrid>` / `<Card>` / `<LinkCard>`, `<CodeGroup>`, `<FileTree>`, `<TypeTable>` / `<TypeRow>` and `<AutoTypeTable>`. When a site's own library has a component of the same name, the `Docs` prefix (`<DocsCallout>`) still reaches the built-in.
8+
4. **Live examples:** a ```` ```razor:preview ```` fence, `<ComponentPreview>`, or `<DemoPreview Component="X" />` for a `.razor` file under `DemoSourceRoot`. A `razor:preview` body is Razor, not Markdown: use `<code>` and `<strong>`, not backticks and `**`. Components used in Markdown must be registered with `RegisterComponent<T>()` or `RegisterComponentsFromAssembly<T>()`.
9+
5. **Attribute values on tags in Markdown are plain text.** They aren't Markdown and HTML entities aren't decoded. There is no escape for the quote character, so switch between single and double quotes.
10+
6. **Configuration lives in `AddShellDocs(o => ...)` in `Program.cs`:** site details, navigation, packages, versions, redirects, previews and `EnableLlmsTxt`.
11+
7. **Static sites come from `shelldocs build`.** Don't edit the `publish/` output by hand, and don't add `--spa-fallback` unless the host needs it: it replaces the not-found page with the home page.

‎Program.cs‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@
2323
o.RegisterComponentsFromAssembly<App>("ShellDocs.Site.Components.Demos");
2424
o.DemoSourceRoot = Path.Combine(builder.Environment.ContentRootPath, "Components", "Demos");
2525

26+
// /llms.txt, every page as Markdown at its URL + ".md", agent instruction
27+
// files and the page actions menu by the title.
28+
o.EnableLlmsTxt(l =>
29+
{
30+
l.Summary = "ShellDocs is a docs framework for .NET: Markdown pages, live Blazor component previews, search and a static export, in a Blazor Web App.";
31+
l.RulesFile = "Llms/agent-rules.md";
32+
l.InstallCommandPattern = @"(?m)(?<=^[ \t]*)dotnet (?:tool install -g ShellDocs\.CLI|add package ShellDocs\.\w+)[^\r\n]*";
33+
});
34+
2635
// Top nav: three tabs. Package-specific navigation lives entirely in the
2736
// sidebar's package selector, not up here.
2837
o.AddNavLink("Documentation", "/docs/introduction");

‎README.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ content/
5858
configuration.md
5959
authoring/ frontmatter, code fences, razor:preview, inline tags, navigation
6060
components/ one page per content primitive
61-
guides/ component libraries, versioning, redirects, search, not-found, deployment
61+
guides/ component libraries, versioning, redirects, search, llms.txt, not-found, deployment
6262
cli/ init, add, dev, build
6363
theming.md
6464
packages/ one overview per NuGet package
@@ -68,6 +68,8 @@ wwwroot/
6868
demos/ static pages shown with <IframePreview>
6969
cli-replay.js the terminal replay on the home page
7070
copy-button.js copy buttons marked with data-copy
71+
Llms/
72+
agent-rules.md rules for AI agents, shown in /llms.txt and the agent files
7173
Components/
7274
Demos/ demo components shown with <DemoPreview>
7375
Home/ the animated feature bento on the home page
@@ -76,7 +78,7 @@ Components/
7678

7779
## Framework version
7880

79-
The site references `ShellDocs.* 0.1.15-alpha`. On a new release, bump the four package versions in `ShellDocs.Site.csproj` and the CLI version pinned in `.github/workflows/deploy-pages.yml` together.
81+
The site references `ShellDocs.* 0.1.17-alpha`. On a new release, bump the four package versions in `ShellDocs.Site.csproj` and the CLI version pinned in `.github/workflows/deploy-pages.yml` together.
8082

8183
## License
8284

‎ShellDocs.Site.csproj‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
</PropertyGroup>
2020

2121
<ItemGroup>
22-
<PackageReference Include="ShellDocs.Components" Version="0.1.15-alpha" />
23-
<PackageReference Include="ShellDocs.Core" Version="0.1.15-alpha" />
24-
<PackageReference Include="ShellDocs.Markdown" Version="0.1.15-alpha" />
25-
<PackageReference Include="ShellDocs.Tokens" Version="0.1.15-alpha" />
22+
<PackageReference Include="ShellDocs.Components" Version="0.1.17-alpha" />
23+
<PackageReference Include="ShellDocs.Core" Version="0.1.17-alpha" />
24+
<PackageReference Include="ShellDocs.Markdown" Version="0.1.17-alpha" />
25+
<PackageReference Include="ShellDocs.Tokens" Version="0.1.17-alpha" />
2626
</ItemGroup>
2727

2828
<ItemGroup>
@@ -32,6 +32,8 @@
3232
<Content Update="content/**/meta.json" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" />
3333
<!-- DemoPreview reads these at runtime; the Razor SDK drops .razor files from publish otherwise. -->
3434
<None Include="Components/Demos/**/*.razor" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" />
35+
<!-- EnableLlmsTxt reads the rules file at runtime, from the output folder and from the export's publish. -->
36+
<None Update="Llms/agent-rules.md" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" />
3537
</ItemGroup>
3638

3739
</Project>

‎content/docs/authoring/fenced-code.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Fenced code
3-
description: Regular code fences : language detection, copy button, Shiki syntax highlighting.
3+
description: "Regular code fences: language detection, copy button, Shiki syntax highlighting."
44
order: 2
55
---
66

@@ -109,7 +109,7 @@ dotnet add package ShellDocs.Components --prerelease
109109
<CodeTab Label="PackageReference">
110110

111111
```xml
112-
<PackageReference Include="ShellDocs.Components" Version="0.1.15-alpha" />
112+
<PackageReference Include="ShellDocs.Components" Version="0.1.17-alpha" />
113113
```
114114

115115
</CodeTab>

‎content/docs/authoring/razor-preview.md‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,13 @@ This renders as a real Callout component.
2424
</Callout>
2525
```
2626

27-
The tags must be components registered with ShellDocs : the built-in primitives, or [your own](/docs/guides/component-libraries).
27+
The tags can be components registered with ShellDocs : the built-in primitives, or [your own](/docs/guides/component-libraries). A fence of plain HTML renders live too:
28+
29+
```razor:preview
30+
<p style="margin:0">A fence with <strong>only HTML</strong> and no component.</p>
31+
```
32+
33+
A fence with no tags at all stays a code block, and a warning is logged. Before `0.1.17-alpha` an HTML-only fence also rendered as a code block.
2834

2935
## The body is Razor, not markdown
3036

‎content/docs/cli/build.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ Requests a URL that doesn't exist and saves the site's not-found view as `404.ht
4848
<Step Title="Copies the search index">
4949
Saves the app's search index as `_shelldocs/search.json`, which is what makes search work without a server.
5050
</Step>
51+
<Step Title="Writes the llms.txt files">
52+
On a site that calls `EnableLlmsTxt`, writes `llms.txt`, `llms-full.txt`, every page's `.md` and the agent files. Their links use `--site-url`, then `SiteUrl`. See [AI agents (llms.txt)](/docs/guides/llms-txt).
53+
</Step>
5154
<Step Title="Copies the assets">
5255
Merges the published `wwwroot` into the output: framework scripts, `shelldocs.js`, stylesheets, your own static files. Prerendered pages are never overwritten.
5356
</Step>

0 commit comments

Comments
 (0)