Add versioned HTML index sources and systemd documentation - #137
Conversation
moshest
left a comment
There was a problem hiding this comment.
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 lintclean,pnpm buildclean,pnpm test317 passed (224 context + 93 registry).- Spot-checked the crawl:
systemctl,journalctl,systemd.service,systemd.unit,systemd.network,systemd.exec,loginctlall 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
- Both systemd packages are frozen.
systemd@258needs a manual PR per release. Worse,systemd-guidesis unversioned but pinned toref: v258—getHeadCommiton a tag never changes, so after the first publish the skip-if-unchanged check fires forever andlatestis permanently v258. An unversioned definition normally tracks tip; this one silently won't. Consider droppingref:there, or at least a comment saying it's deliberate. isZipVersionEntryis now dead outside theindex.tsbarrel and one test assertion. Its meaning also changed ("versions" in entry→source.type === "zip"), so anything still importing it gets different behavior. Worth deleting.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.- The
barePrerule filters onnode.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. - 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
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
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-indexaccepts 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.systemd/systemd@258supplies the reference manuals;systemd/systemd-guides@latestsupplies the guides from Git tagv258. 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.v258: 531 sections and 220,331 tokens; passed the CI registry-validation command.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.