[renderer] Tree shape — discovery-map renderer (spike → keeper)#351
Closed
leeovery wants to merge 5 commits into
Closed
[renderer] Tree shape — discovery-map renderer (spike → keeper)#351leeovery wants to merge 5 commits into
leeovery wants to merge 5 commits into
Conversation
Adds the first genuine tree shape on the shared wrapWithPrefix core: branch glyphs (├─/└─, hangs off header, never ┌─), leading tier glyph, name [lifecycle], and wrapped summary/provenance sub-lines under a continuous │ gutter (dropped on the last row). Wrap budget subtracts the 9-char gutter, so the 74-col orphan bug is structurally impossible. CLI `tree` reads a JSON node array on stdin (data-owner builds it); renderTree exported for in-process use. Spike proven: structural rows byte-exact vs the documented hand-drawn map; every body line within width at 49/58/65. Header rows are single-line/data-determined (a long label+tag is unwrappable — same as hand-drawn). 6 new tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Node shape now { glyph?, label, tag?, summary?, provenance? } (explicit
fields, was an opaque body[]). Provenance renders as a distinct
`· `-marked line with its first letter capitalised, so it reads as
metadata rather than a continuation of the summary. Default tree width
72 (configurable per call / --width).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Switch the provenance marker from · to ↳ so it reads as 'derived from'. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Split layout from content. renderTree node is now { title, body?,
children? } — pure layout (branch glyphs, continuous gutter, wrap,
recursion), knowing nothing about glyphs/tags/provenance. Adds children
recursion (arbitrary depth, e.g. the discussion map).
New conventions.cjs is the domain-aware composition layer: title()
(glyph+label+[tag]), tag(), derivedFrom() (↳, capitalised), and the
discovery-tier glyph vocabulary. Callers compose strings here, keeping
format normalised in one place while the renderer stays domain-free.
Flat discovery map renders byte-identically. 30 tests (incl. nesting +
conventions).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Drop the residual 1-column gap between a node's wrapped body and its branched children. Both now derive from childPrefix: children add a branch glyph, body indents by the branch width to land at the same content column. Simpler (one rule, derived not hardcoded) and tidier (body text and child rows align). Discovery body shifts col 9 → 8. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jun 4, 2026
Owner
Author
|
Consolidated into #380 (single branch off current main, same content, additive-only). Closing to keep one clean hand-off PR. |
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
Stacked on #348. Adds
renderTree— the first genuine continuous-gutter tree, on the sharedwrapWithPrefixcore. This was the go/no-go spike for the whole renderer; it came out clean, so the code is kept.├─/└─(hangs off the header, never┌─), leading tier glyph,name [lifecycle], wrapped summary/provenance sub-lines under a continuous│gutter (dropped on the last row).treereads a JSON node array on stdin (the data-owner builds it; Claude never assembles tree JSON);renderTreeexported for in-process use.Spike findings
label [lifecycle]row (e.g. 70 cols) can't wrap without breaking glyph alignment; the hand-drawn version overruns identically. Mitigation (truncation) is a separate decision.Test plan
node --test tests/scripts/test-render.cjs— 23 tests (6 new for the tree: byte-exact rows, hang-off-header, body-within-width across widths, continuous/dropped gutter, single-node└─).🤖 Generated with Claude Code