Skip to content

Add versioned HTML index sources and systemd documentation - #137

Merged
moshest merged 1 commit into
neuledge:mainfrom
TheRealBecks:TheRealBecks/issue116
Sep 21, 2026
Merged

moshest merged 1 commit into
neuledge:mainfrom
TheRealBecks:TheRealBecks/issue116

Conversation

@TheRealBecks

Copy link
Copy Markdown
Contributor

Systemd's reference manuals live in DocBook XML, so indexing its Markdown guides omits systemctl, journalctl, unit configuration and most APIs. This implements the rendered-HTML approach proposed in #116: a versioned HTML-index source and two systemd registry packages.

  • html-index accepts explicit numeric releases and an HTTPS URL with a {version} directory. It fetches the index's HTML links within that origin and directory, with bounded concurrency, timeouts, retries, response/page limits, and redirects checked before following them. Failed downloads fail the build.
  • Raw downloads are cached by URL; identical manual aliases are indexed once. The existing nightly publisher skips releases that are already published. The importer uses LinkeDOM, already present in the workspace. The schema, CLI listing and version discovery support explicit HTML releases.
  • systemd/systemd@258 supplies the reference manuals; systemd/systemd-guides@latest supplies the guides from Git tag v258. Registry documentation explains the source schema, limits and cache refresh procedure.

Live validation also exposed that Turndown flattens DocBook's bare <pre> elements. A small HTML-parser fix preserves these as fenced code blocks, with regression tests and a patch changeset.

Validation:

  • pnpm install --frozen-lockfile, pnpm lint, pnpm build, pnpm test — passed; 317 tests.
  • Systemd 258: 1,229 manual URLs deduplicated to 432 documents, 3,234 sections and 1,108,416 tokens. Confirmed key manuals, service examples and SQLite integrity.
  • Guides at v258: 531 sections and 220,331 tokens; passed the CI registry-validation command.
  • The manuals also passed automatic version discovery and a cached build with network requests disabled.

Versions are advanced deliberately in the definitions. Cached release content is reused until its cache is removed; no native XML processing is added.

Closes #116.

@moshest moshest left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does this close #116?

Yes. The issue title says DocBook, but the maintainer's comment on #116 explicitly rejected native XML parsing and asked for exactly this — a pinned HTML-index source over freedesktop.org's rendered man pages. This is the requested mechanism, and it delivers the content the issue was actually about. Closes #116 is legitimate.

The one part of #116 not implemented is point 5 (multiple docs_path roots). Solved here by shipping two packages instead, which the maintainer also offered. Fine.

Verified numbers

Built from a clean worktree at a2cc15d:

  • systemd (html-index, 258): 3,234 sections, 1,108,416 tokens, 432 documents from 1,229 index links after dedup. Matches your claim exactly.
  • systemd-guides (git, v258): 531 sections, 220,331 tokens. Matches.
  • pnpm lint clean, pnpm build clean, pnpm test 317 passed (224 context + 93 registry).
  • Spot-checked the crawl: systemctl, journalctl, systemd.service, systemd.unit, systemd.network, systemd.exec, loginctl all present.

Nightly risk

Traced it. publish-all wraps both discoverVersions and the per-version build in try/catch, so a throwing html-index records one failure and keeps going — the other ~140 packages still publish, and the job exits 1 at the summary. The only path that aborts everything is listDefinitions throwing on a schema error, which is pre-existing for git and zip too. Acceptable.

Crawl cost is also one-time: checkPackageExists runs before the build, so after 258 publishes once, nightly makes zero fetches to freedesktop.org.

Notes, none blocking

  1. Both systemd packages are frozen. systemd@258 needs a manual PR per release. Worse, systemd-guides is unversioned but pinned to ref: v258 — getHeadCommit on a tag never changes, so after the first publish the skip-if-unchanged check fires forever and latest is permanently v258. An unversioned definition normally tracks tip; this one silently won't. Consider dropping ref: there, or at least a comment saying it's deliberate.
  2. isZipVersionEntry is now dead outside the index.ts barrel and one test assertion. Its meaning also changed ("versions" in entry → source.type === "zip"), so anything still importing it gets different behavior. Worth deleting.
  3. registry/README.md "Where the file goes" still says non-package-manager projects get "a directory named after the project containing a single self-named file". registry/systemd/ now has two. The new html-index section explains it, but the earlier rule now contradicts the tree.
  4. The barePre rule filters on node.firstChild?.nodeName !== "CODE". A <pre> with whitespace before <code class="language-x"> has a text node first, so it takes the bare path and loses the language fence. Edge case, but the third test only covers the no-whitespace form.
  5. No automated robots.txt check — the README makes it a manual reviewer step. Reasonable for now, just flagging that a 1,229-page crawl of a third-party site rests on a prose instruction.

Docs and changeset are both right: registry/README.md has a real section for the new source type, and the changeset targets @neuledge/context (published) for the html.ts fix, not @neuledge/registry (private).


Generated by Claude Code

@moshest
moshest merged commit 8cc952d into neuledge:main Sep 21, 2026
4 checks passed
@github-actions github-actions Bot mentioned this pull request Sep 21, 2026
moshest pushed a commit that referenced this pull request Sep 22, 2026
Releases @neuledge/context 1.2.4 -> 1.2.5 (patch).

Consumed one changeset, .changeset/tidy-manual-examples.md, declared as a
patch on @neuledge/context and added by #137: preserve code formatting in
HTML documentation that uses bare preformatted blocks, including systemd's
rendered DocBook manuals. It was the only changeset on main, it names the
published package only, and a patch bump is the right size for it.

@neuledge/registry 0.0.17 -> 0.0.18 is the automatic dependent bump that
changesets emits for the workspace:* dependency. It is "private": true, is
not published, appears in no changeset, and matches the shape of the last
release PR (#129).

Cross-checked recently merged work: #133, #149 and #150 add registry YAML
definitions only and #136 changes the private registry package only, so
none of them warrants a changeset. No user-facing packages/context change
merged without one.

Verified against npm before merging: dist-tags.latest for @neuledge/context
is 1.2.4 and 1.2.5 is absent from the published version list, so the new
version is strictly greater and does not collide.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NBQQpA86yYzwJUiVz8ph2R
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.

Support DocBook XML sources for complete systemd documentation

2 participants