Repository navigation
feat(site): per-article source map, on by default and switchable (0.7.87) - #88
Merged
Merged
Conversation
…ite.sourceMap) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
0.7.87: each website article now ends with a source map instead of a plain list of source labels (on by default,
site.sourceMap: falseturns it off). The release also ships the source checklist template from #87.Compatibility
site.sourceMap: falsekeeps the previous plain source list. Sites re-render on the nextcontext build.kbPackage.sitegains an optional booleansourceMap. Leaving it unset means on; the parsed configuration gains no field, so existing site configurations and receipts are unaffected.d3-force@3.0.0(ISC, bundled into the CLI); dev dependency@types/d3-force@3.0.10.Verification
See "Testing" below.
Checklist
bun run verify:fullpasses.Background
The "Sources" area at the end of an article was a list of labels (
module/path L1–L5 · commit). Readers could not see which section relied on which document, where the documents came from, or which other articles cite the same material. All of that is already known at build time: the structure file records every section's references and line ranges, the source registry knows repositories, Lark documents and notes, and the link logic already exists.Changes
packageSiteSourceMap.ts(new): per-article map data — sections; cited documents grouped by source (repository module and directory, Lark, notes; coarsened to at most six groups); each citation's lines and link; other articles citing the same documents. The layout usesd3-forcewith a fixed seed, so builds are deterministic, and produces blob circles, tilted group-name positions, label room and a fitted height. Document titles: repository files by path; Lark and notes from their committed titles.packageSiteSources.ts: the per-reference link resolution is extracted assiteReferenceSource; the plain source list output is unchanged.packageSite.ts: writescontextSourceMapfrontmatter whensite.sourceMap !== false; section titles per reader language come from translations.packageSiteTheme.ts: Map/List switch (remembered; narrow screens show the list). Flat blobs — article sections purple, repository files green, Skills magenta, Lark documents blue, notes orange. Hover highlights links and shows line ranges; clicking a document opens the cited lines and clicking a section scrolls to it. Group names follow the blob edge; labels stay on one line when their row has room and otherwise wrap into balanced lines. The list shows each document on two lines: title, path and line ranges; then the sections using it.@c4a/contextpackageSite.ts: thesourceMapoption; docs (package outputs, project API and their workflow copies).bun.lockonly adds the dependency entries and workspace version lines, with no download URLs.Risks
site.sourceMap: false.Backward compatibility
No action needed for existing workspaces; the next build shows the map. Configurations without
sourceMapparse unchanged, and CLI JSON is unchanged.Testing
packageSiteSourceMap.test.ts(5 pass): only recorded references are used; grouping and titles; lines and links match the source list; articles sharing documents; deterministic, in-bounds layout; group-name tilt limit; coarsening many directories; type colours; section-title extraction.packageSite.test.ts: a real site build renders the map by default (section anchors and related-article links), and a newsourceMap: falsebuild keeps the plain list;packageSiteBuild.integrationpasses.bun run verify:fullpasses.🤖 Generated with Claude Code