Skip to content

docs(site): add llms.txt + .md companions - #2404

Merged
max-sixty merged 2 commits into
mainfrom
llm-docs
Apr 24, 2026
Merged

max-sixty merged 2 commits into
mainfrom
llm-docs

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Summary

Implements the llms.txt spec for the docs site:

  • worktrunk.dev/llms.txt — curated index listing every doc page, grouped by sidebar section (Commands, Reference) and ordered by weight. Generated from docs/content/*.md front-matter.
  • worktrunk.dev/<page>.md — clean-markdown versions of each doc page, served as symlinks from docs/static/*.md into skills/worktrunk/reference/*.md. Zola follows the symlinks at build time, so there's no content duplication — just 13 symlink entries in git, alongside the existing docs/static/.well-known/agent-skills/worktrunk symlink.

What changed

  • 13 symlinks at docs/static/*.md → ../../skills/worktrunk/reference/*.md
  • docs/static/llms.txt — generated output (checked in, same as skills/worktrunk/reference/ and .well-known/agent-skills/index.json)
  • sync_llms_txt() + extract_intro_prose() + docs_content_page_names() helpers in tests/integration_tests/readme_sync.rs
  • Step 4 added to test_command_pages_and_skill_files_are_in_sync — CI catches drift if front-matter changes and llms.txt isn't regenerated

The new directory-walk helper (docs_content_page_names) is shared with sync_skill_files, which had the same walk inlined.

Test plan

  • cargo test --test integration readme_sync — 13/13 pass, idempotent on re-run
  • cargo fmt + cargo clippy --all-targets --all-features -- -D warnings — clean
  • pre-commit run --files tests/integration_tests/readme_sync.rs — pass
  • zola build produces public/merge.md etc. as real 4814-byte files (not symlinks) and public/llms.txt
  • CI green

This was written by Claude Code on behalf of @max-sixty

Implements the llms.txt spec (https://llmstxt.org/): a curated markdown
index at worktrunk.dev/llms.txt listing every doc page, grouped by
sidebar section and ordered by weight, with link targets pointing at
new .md companion URLs (worktrunk.dev/<page>.md).

The companions are symlinks from docs/static/*.md into
skills/worktrunk/reference/*.md. Zola follows them at build time, so
there's no content duplication — just 13 small symlink entries in git,
alongside the existing docs/static/.well-known/agent-skills/worktrunk
symlink.

llms.txt itself is generated by a new Step 4 in
test_command_pages_and_skill_files_are_in_sync, from docs/content
front-matter (title, description, weight, extra.group). CI catches
drift the same way it does for skills/ and .well-known/agent-skills/.
The directory walk over docs/content/*.md is extracted into a shared
helper now that two sync steps need it.

Co-authored-by: Claude <[email protected]>

@worktrunk-bot worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One doc-comment glitch: sync_skill_files's old three-line docstring now ties into the new helper's docstring (rustdoc merges consecutive /// lines), so the helper gets described as syncing docs to skill files and sync_skill_files itself is left undocumented. Suggested fix inline.

Minor nit (no fix needed): the .expect("non-home pages must declare [extra] group") at line 2389 is unreachable — ungrouped pages are already filtered by the continue above. If you ever simplify this, storing (slug, group, fm) in pages and dropping the second extra.group lookup reads more directly.

Comment thread tests/integration_tests/readme_sync.rs Outdated
Comment on lines +2071 to +2075
/// Sync all docs/content/*.md files to skills/worktrunk/reference/*.md
/// (excluding _index.md which is a Zola template)
/// Returns (errors, updated_files)
/// Sorted `.md` page filenames in `docs/content/` (excluding `_index.md`
/// and similar underscore-prefixed Zola section markers).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Sync all docs/content/*.md files to skills/worktrunk/reference/*.md
/// (excluding _index.md which is a Zola template)
/// Returns (errors, updated_files)
/// Sorted `.md` page filenames in `docs/content/` (excluding `_index.md`
/// and similar underscore-prefixed Zola section markers).
/// Sorted `.md` page filenames in `docs/content/` (excluding `_index.md`
/// and similar underscore-prefixed Zola section markers).

The three lines above (/// Sync all docs/content/*.md files ...) were sync_skill_files's docstring before the extraction — they're now glued onto docs_content_page_names, which describes a narrower helper and doesn't return (errors, updated_files). Dropping them restores the accurate doc; if you want a separate docstring for sync_skill_files, add one at line 2088.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 535aa44 — dropped the stale sync_skill_files docstring lines from docs_content_page_names.

On the nit: noted but leaving as-is for now — agree threading the group through pages reads more directly if this area gets touched again.

The three-line docstring describing `sync_skill_files` stayed attached
to the top of `docs_content_page_names` after extraction, so rustdoc
merged it with the helper's own two-line doc and described the helper
as syncing docs to skill files.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@max-sixty
max-sixty merged commit 89dceed into main Apr 24, 2026
25 checks passed
@max-sixty
max-sixty deleted the llm-docs branch April 24, 2026 00:33
max-sixty added a commit that referenced this pull request Apr 24, 2026
## Summary

Three small cleanups to the docs/skills sync pipeline (flagged by
`/simplify` review on #2404 but deferred at the time):

- **`readme_sync.rs`** — extract a `write_tracked(path, expected,
rel_path, updated)` helper that handles `fs::create_dir_all` +
`fs::write` + push-to-`updated_files`. Applied at five call sites:
`sync_command_pages`, `convert_console_blocks_in_docs`,
`sync_skill_files`, `sync_well_known_skills`, `sync_llms_txt`. Callers
keep control of the "is it different?" check so each site can apply its
own normalization (e.g., `trim_lines`) before comparing.

- **`sync_llms_txt`** — merge the two parse/group loops. Use `let-else`
to pull out `extra.group` when the frontmatter is first parsed, then
push directly into the `BTreeMap`. Drops both the intermediate
`Vec<(String, Frontmatter)>` and an unreachable `.expect("non-home pages
must declare [extra] group")` that only existed because the group was
looked up twice.

- **`.gitattributes`** — new file. Marks the 14 auto-generated outputs
as `linguist-generated=true` so GitHub collapses them in PR diffs.
Targets `skills/worktrunk/reference/*.md`, `docs/static/*.md` (the `.md`
symlinks), `docs/static/llms.txt`, and
`docs/static/.well-known/agent-skills/index.json`. Primary sources
(`docs/content/*.md`, `src/cli/mod.rs`) stay fully visible — `git
check-attr` confirms.

No behavior change; all 13 `readme_sync` tests pass, `cargo clippy
--all-targets --all-features -- -D warnings` clean, `cargo fmt` clean.

## Test plan
- [x] `cargo test --test integration readme_sync` — 13 passed
- [x] `cargo clippy --all-targets --all-features -- -D warnings` — clean
- [x] `cargo fmt --check` — clean
- [x] `git check-attr linguist-generated` on a sample of generated +
primary-source files — generated flip to `true`, primary sources stay
`unspecified`

> _This was written by Claude Code on behalf of @max-sixty_

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: worktrunk-bot <[email protected]>
max-sixty added a commit that referenced this pull request Apr 24, 2026
…2412)

## Summary

Two independent follow-ups from #2404 (llms.txt PR), surfaced during
that session:

**1. `refactor(help): unify --help-page plain/web paths behind
PageMode`**
Replaces `plain: bool` threaded through four functions
(`handle_help_page`, `format_subcommand_section`,
`expand_subdoc_placeholders`, and the caller in
`maybe_handle_help_with_pager`) with a `PageMode { Web, Plain }` enum.
The enum's methods encapsulate each mode-dependent branch — color
choice, raw-help transforms, body/subdoc-trailing processing, the
experimental badge, and the page header/footer. Result: ~10 `if plain {
... } else { ... }` branches become single method calls; the bool→enum
switch also catches `Self::_` exhaustiveness if new modes are added.
Extracts `BADGE_EXPERIMENTAL_HTML` as a constant to dedupe the
empty-span literal between `experimental_marker` and
`post_process_for_html`.

**2. `chore(ci): link-check .txt files with lychee`**
Switches the `lychee-system` pre-commit hook from `types: [markdown]` to
`files: '\.(md|txt)$'` so `docs/static/llms.txt` URLs get verified
alongside `.md` docs. `identify` has no `.txt` tag, so a files-regex is
the clearest way to widen the set.

## Test plan

- [x] `test_command_pages_and_skill_files_are_in_sync` — passes
unchanged (byte-identical `--help-page` output for both modes)
- [x] `test_help` — all 40 snapshot tests pass
- [x] `cargo test --lib --bins` — 606 unit tests pass
- [x] `cargo clippy --all-targets --all-features -- -D warnings` — clean
- [x] `pre-commit run --all-files` — all hooks pass, including
lychee-system on the expanded file set (llms.txt URLs already check out)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude <[email protected]>
worktrunk-bot added a commit to alvistar/worktrunk that referenced this pull request Apr 25, 2026
Regenerates docs/static/llms.txt (added in max-sixty#2404, post merge-base of this
branch) so its tips-patterns.md description picks up the "cmux workspaces"
addition introduced in 6e259a2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants