feat(terminal): auto-abbreviate to short codes + legend on overflow - #20
Merged
Merged
Conversation
When a compact chain or diamond would exceed the column budget in the default `auto` direction, node labels are replaced with short, deterministic codes and a `Legend` block mapping each code to its full name is appended — so a near-linear flow stays one readable row instead of collapsing to the stacked vertical list. Codes derive from the names (word initials, or first-letter + consonants for a single word), de-duped in node order; nothing is invented. Explicit `direction:"horizontal"` keeps its strict error contract, so the change slots into a previously-uncovered column band and moves no existing test. Mirrored byte-identically in the Python twin (language-parity law) with a new parity test in each suite. Skill doc notes the behavior so callers can pass full names and let the renderer decide.
bigboateng
added a commit
that referenced
this pull request
Jul 29, 2026
* feat(examples): render a diagram from a JSON spec (example 19) Add a JSON->diagram loader so tools and agents that hold a graph as plain data can render it deterministically. Reads a spec (file path or stdin), builds the graph with identity transforms, and prints via the terminal viewer. TypeScript + byte-identical Python twin. * feat(skills): cmg skill — terminal system diagrams from any chat context Drives example 19: maps whatever is in context (an architecture, a pipeline, a Locus model/verdict, two designs) to a JSON graph spec and renders it with the deterministic terminal viewer. Source of truth for the byte-identical installs under ~/.claude/skills and ~/.codex/skills. * feat(terminal): auto-abbreviate to short codes + legend on overflow (#20) When a compact chain or diamond would exceed the column budget in the default `auto` direction, node labels are replaced with short, deterministic codes and a `Legend` block mapping each code to its full name is appended — so a near-linear flow stays one readable row instead of collapsing to the stacked vertical list. Codes derive from the names (word initials, or first-letter + consonants for a single word), de-duped in node order; nothing is invented. Explicit `direction:"horizontal"` keeps its strict error contract, so the change slots into a previously-uncovered column band and moves no existing test. Mirrored byte-identically in the Python twin (language-parity law) with a new parity test in each suite. Skill doc notes the behavior so callers can pass full names and let the renderer decide.
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.
Stacked on #19 (base is
render-json-example, sinceskills/cmg/SKILL.mdis introduced there). Merge #19 first, then rebase this ontomain.What
In the default
autodirection, when a compact chain or diamond would exceed the column budget, node labels are replaced with short, deterministic codes and aLegendblock mapping each code back to its full name is appended. A near-linear flow now stays one readable row instead of collapsing into the stacked vertical node-list +Edgesfallback.How
auto. Explicitdirection:"horizontal"keeps its strictrequires N columnserror contract; explicitverticalis untouched. The behavior slots into a previously-uncovered middle column band, so no existing test moves.Parity & tests
terminal/__init__.py) per the language-parity law; verified TS↔Python identical on chain-overflow, diamond-overflow, and narrow-vertical-fallback.terminal.test.ts18 ✓,test_terminal.py10 ✓). Typecheck clean; example-19 snapshot unchanged.Skill doc
skills/cmg/SKILL.mdgains a note that fullnames are now fine inautomode (the renderer abbreviates + legends automatically). This diff also folds in the earlier, still-uncommitted "paste inside a code fence" rendering guidance (fixes the proportional-font wrapping seen in GUI chats like Codex).