Conversation
Baseline: packages/client/src = 25,613 LOC across 189 files.
Target: extract app-agnostic SolidJS into @kolu/solid-{icons,ui,overlay,platform}.
Move ui/Icons.tsx (38 SVG components, zero Kolu-domain coupling) into a reusable workspace package; rewrite 26 import sites to @kolu/solid-icons. Behaviour-preserving. client/src: 25,613 -> 24,998 LOC (-615). just check + just test-unit green (200 client tests).
Lift the WebGL-context lifecycle (load/unload, GPU-context release that xterm omits, link-layer canvas capture, texture-atlas management) out of the 950-LOC Terminal.tsx into a reusable createXtermWebgl primitive. The leak-critical async mount/cleanup ordering (#591/#606/#575) stays at the call site where SolidJS owner capture must happen; only the WebGL function bodies move. The temporary #591 zombie-context tracker stays in the client and is inverted into the primitive via optional lifecycle hooks, so the library carries no Kolu debug dependency. Behaviour-preserving. client/src: 24,998 -> 24,942 LOC (-56); Terminal.tsx 950 -> 894. Gated by just check + test-unit (200 client) + 74 e2e scenarios (canvas multi-tile + screenshot exercise WebGL paths).
Move the design-system atoms (Toggle, Kbd, SegmentedControl, Row, Section, Surface, stackLayers, Tip) into a reusable workspace package. All eight are fully self-contained (solid-js + @corvu/tooltip only). Subpath exports keep each module's default/named contract, so the 36 import sites are a pure path rewrite. Behaviour-preserving. client/src: 24,942 -> 24,662 LOC (-280). just check + just test-unit green (200 client tests).
…ives Move useAnchoredPopover (open/dismiss + viewport-flip placement, portal-safe) and OptionMenu (anchored option list built on it) into a reusable package. The unit test moves with the primitive and now runs in-package (solid-overlay vitest), so client drops from 200 to 199 tests with coverage preserved. Behaviour-preserving. client/src: 24,662 -> 24,405 LOC (-257). just check + just test-unit green.
Move keyboard (chord matching), os (Apple-modifier detection), and clipboard (non-secure-context-safe writes + xterm provider) into a reusable package. These are framework-agnostic — no solid-js dependency — so the package omits the solid- prefix the other extractions carry. 23 import sites rewritten via subpath exports; keyboard.test stays in client (it pairs keyboard with Kolu ACTIONS/prohibitedKeybinds) and now consumes the package. Behaviour-preserving. client/src: 24,405 -> 24,201 LOC (-204).
default.nix's src fileset is an explicit allowlist; the five extracted packages (solid-icons, solid-ui, solid-overlay, solid-xterm, platform) must be listed or they're absent from the sandboxed build and the client vite build fails to resolve their imports. Also document them in the README architecture table. Verified: just build (nix server+client) green; pnpm-hash-fresh green.
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.
What
Kolu's client (
packages/client/src) carried a lot of app-agnostic SolidJS code —generic UI atoms, an icon set, popover primitives, a WebGL-context manager,
keyboard/clipboard helpers. This PR extracts that code into reusable workspace
packages, following the existing
@kolu/solid-pierreprecedent, so the main appshrinks to the code that's actually Kolu-specific: −1,412 LOC (−5.5%), 189 → 174 files.
Driven by the Ralph loop (measure → profile → extract the biggest clean
candidate → re-measure → commit only on real reduction). Full methodology,
per-cycle log, and dead-ends in
docs/client-loc-ralph-report.md.Every extraction is behaviour-preserving (mechanical move + re-export).
Packages extracted
@kolu/solid-iconsIcons(38 SVG components)@kolu/solid-uiToggle,Kbd,SegmentedControl,Row,Section,Surface,stackLayers,Tip@kolu/solid-overlayuseAnchoredPopover(+test),OptionMenu@kolu/solid-xtermcreateXtermWebgl@kolu/platformkeyboard,os,clipboardsolid-js, hence nosolid-prefix)The
solid-xtermcycle (read this one)Unlike the others, xterm is complected with Kolu's session wiring in the 950-LOC
Terminal.tsx, and its async mount is a minefield of heap-leak fixes (#591/#606/#575)with no automated guard — caught only by manual heap snapshots; the e2e covers
terminal behaviour, not disposal. So a wholesale rip would be irresponsible.
The responsible seam is the WebGL-context lifecycle (
createXtermWebgl): the mostreusable, hardest-won, self-contained xterm knowledge (Chrome's ~16-context limit, the
loseContext()GPU release xterm omits, link-layer canvas capture, texture-atlasmanagement). The leak-critical mount/cleanup ordering stays at the call site where
SolidJS owner capture must happen; only the WebGL function bodies move. The temporary
#591 zombie-context tracker stays in the client and is inverted into the primitive via
optional lifecycle hooks, so the library carries no Kolu debug dependency.
Measurements
client/srcLOCclient/srcfilesVerification
All CI gates green locally:
typecheck(pnpm -r),biome lint,unit(server + client + the relocated
solid-overlaytest),fmt-check,nix build(server + client),
pnpm-hash-fresh,surface-example-build,smoke, and e2e(106 scenarios — terminal/canvas/screenshot/sub-terminal + command-palette/keyboard-shortcuts;
canvas-multi-tile + screenshot exercise the WebGL paths).
🤖 Generated with Claude Code