modscode / Gallery / loc-split
loc-split
Lines changed against main, split into code, comments, tests, docs and generated files, in a row above the prompt that expands into a per-commit table
What it does
- Draws a band above the prompt
- Adds /loc-split
- Watches tool calls
- Hooks session.start, turn.complete
- Keeps its own state between turns
Good points
- No network calls
- Written in TypeScript
- Has a desktop-specific branch
- Handles errors
Code to start from
Two kinds: a starter modscode writes from the design above, and the lines of the mod's own code that draw it.
Starter (register.tsx)
import type { Register } from 'claude-code'
// Drawn like loc-split by Roman Hotsiy (band), as modscode read it from the mod's code:
// https://modscode.com/gallery/romanhotsiy-loc-split/
// Written by modscode from that reading, not copied from the mod: use it as you like.
// Each value below stands for one the mod works out at run time; put in your own.
export const register: Register = on => {
// the band above the prompt; what else goes there is drawn under it
on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
const { Box, Text, Button } = $.ui.resolve(e)
const titleOf = '…'
const offset = '…'
const length = '…'
const name = '…'
const name2 = '…'
const name3 = '…'
const sha = '…'
const subject = '…'
const added = '…'
const removed = '…'
const added2 = '…'
const removed2 = '…'
const added3 = '…'
const removed3 = '…'
const sha2 = '…'
const subject2 = '…'
const added4 = '…'
const removed4 = '…'
const added5 = '…'
const removed5 = '…'
const added6 = '…'
const removed6 = '…'
const sha3 = '…'
const subject3 = '…'
const added7 = '…'
const removed7 = '…'
const added8 = '…'
const removed8 = '…'
const added9 = '…'
const removed9 = '…'
const older = '…'
const added10 = '…'
const removed10 = '…'
const added11 = '…'
const removed11 = '…'
const added12 = '…'
const removed12 = '…'
const shortRef = '…'
const added13 = '…'
const removed13 = '…'
const added14 = '…'
const removed14 = '…'
const added15 = '…'
const removed15 = '…'
const toggleLabel = '…'
const LABELS = '…'
const added16 = '…'
const removed16 = '…'
const LABELS2 = '…'
const added17 = '…'
const removed17 = '…'
const LABELS3 = '…'
const added18 = '…'
const removed18 = '…'
return (
<Box flexDirection="column" paddingLeft={1}>
<Box flexDirection="column" marginBottom={1}>
<Box flexDirection="row" justifyContent="space-between">
<Text bold wrap="truncate">
{titleOf}
</Text>
<Box flexShrink={0} marginLeft={2}>
<Text dimColor>
{`${offset}1`}
–
{`${offset}${length}`}
{" of "}
{length}
</Text>
</Box>
</Box>
<Box flexDirection="row">
<Box flexGrow={1} flexShrink={1} />
<Box flexShrink={0} justifyContent="flex-end">
<Text dimColor>
{name}
</Text>
</Box>
<Box flexShrink={0} justifyContent="flex-end">
<Text dimColor>
{name2}
</Text>
</Box>
<Box flexShrink={0} justifyContent="flex-end">
<Text dimColor>
{name3}
</Text>
</Box>
<Box width={3} flexShrink={0} justifyContent="center">
<Button plain label="↑" />
</Box>
</Box>
<Box flexDirection="row" marginTop="0">
<Box flexGrow={1} flexShrink={1} minWidth={0} overflow="hidden">
<Box flexDirection="row" minWidth={0} overflow="hidden">
<Box width={9} flexShrink={0}>
<Text dimColor>
{sha}
</Text>
</Box>
<Box flexShrink={1} minWidth={0} overflow="hidden" marginRight={1}>
<Text wrap="truncate-end">
{subject}
</Text>
</Box>
</Box>
</Box>
<Box flexShrink={0} justifyContent="flex-end">
<Text>
<Text color="success">
+
{added}
</Text>
{" "}
<Text color="error">
−
{removed}
</Text>
</Text>
</Box>
<Box flexShrink={0} justifyContent="flex-end">
<Text>
<Text color="success">
+
{added2}
</Text>
{" "}
<Text color="error">
−
{removed2}
</Text>
</Text>
</Box>
<Box flexShrink={0} justifyContent="flex-end">
<Text>
<Text color="success">
+
{added3}
</Text>
{" "}
<Text color="error">
−
{removed3}
</Text>
</Text>
</Box>
<Box width={3} flexShrink={0} justifyContent="center">
<Text>
•
</Text>
</Box>
</Box>
<Box flexDirection="row" marginTop="0">
<Box flexGrow={1} flexShrink={1} minWidth={0} overflow="hidden">
<Box flexDirection="row" minWidth={0} overflow="hidden">
<Box width={9} flexShrink={0}>
<Text dimColor>
{sha2}
</Text>
</Box>
<Box flexShrink={1} minWidth={0} overflow="hidden" marginRight={1}>
<Text wrap="truncate-end">
{subject2}
</Text>
</Box>
</Box>
</Box>
<Box flexShrink={0} justifyContent="flex-end">
<Text>
<Text color="success">
+
{added4}
</Text>
{" "}
<Text color="error">
−
{removed4}
</Text>
</Text>
</Box>
<Box flexShrink={0} justifyContent="flex-end">
<Text>
<Text color="success">
+
{added5}
</Text>
{" "}
<Text color="error">
−
{removed5}
</Text>
</Text>
</Box>
<Box flexShrink={0} justifyContent="flex-end">
<Text>
<Text color="success">
+
{added6}
</Text>
{" "}
<Text color="error">
−
{removed6}
</Text>
</Text>
</Box>
<Box width={3} flexShrink={0} justifyContent="center">
<Text>
•
</Text>
</Box>
</Box>
<Box flexDirection="row" marginTop="0">
<Box flexGrow={1} flexShrink={1} minWidth={0} overflow="hidden">
<Box flexDirection="row" minWidth={0} overflow="hidden">
<Box width={9} flexShrink={0}>
<Text dimColor>
{sha3}
</Text>
</Box>
<Box flexShrink={1} minWidth={0} overflow="hidden" marginRight={1}>
<Text wrap="truncate-end">
{subject3}
</Text>
</Box>
</Box>
</Box>
<Box flexShrink={0} justifyContent="flex-end">
<Text>
<Text color="success">
+
{added7}
</Text>
{" "}
<Text color="error">
−
{removed7}
</Text>
</Text>
</Box>
<Box flexShrink={0} justifyContent="flex-end">
<Text>
<Text color="success">
+
{added8}
</Text>
{" "}
<Text color="error">
−
{removed8}
</Text>
</Text>
</Box>
<Box flexShrink={0} justifyContent="flex-end">
<Text>
<Text color="success">
+
{added9}
</Text>
{" "}
<Text color="error">
−
{removed9}
</Text>
</Text>
</Box>
<Box width={3} flexShrink={0} justifyContent="center">
<Text>
•
</Text>
</Box>
</Box>
<Box flexDirection="row">
<Box flexGrow={1} />
<Box width={3} flexShrink={0} justifyContent="center">
<Button plain label="↓" />
</Box>
</Box>
<Text dimColor>
{"… "}
{older}
{" older commit"}
{" not listed"}
</Text>
<Box flexDirection="row">
<Box flexGrow={1} flexShrink={1} minWidth={0} overflow="hidden">
<Text color="warning">
✎ uncommitted
</Text>
</Box>
<Box flexShrink={0} justifyContent="flex-end">
<Text>
<Text color="success">
+
{added10}
</Text>
{" "}
<Text color="error">
−
{removed10}
</Text>
</Text>
</Box>
<Box flexShrink={0} justifyContent="flex-end">
<Text>
<Text color="success">
+
{added11}
</Text>
{" "}
<Text color="error">
−
{removed11}
</Text>
</Text>
</Box>
<Box flexShrink={0} justifyContent="flex-end">
<Text>
<Text color="success">
+
{added12}
</Text>
{" "}
<Text color="error">
−
{removed12}
</Text>
</Text>
</Box>
</Box>
<Box flexDirection="row" marginTop="0">
<Box flexGrow={1} flexShrink={1} minWidth={0} overflow="hidden">
<Text bold>
{"Σ net vs "}
{shortRef}
</Text>
</Box>
<Box flexShrink={0} justifyContent="flex-end">
<Text>
<Text color="success">
+
{added13}
</Text>
{" "}
<Text color="error">
−
{removed13}
</Text>
</Text>
</Box>
<Box flexShrink={0} justifyContent="flex-end">
<Text>
<Text color="success">
+
{added14}
</Text>
{" "}
<Text color="error">
−
{removed14}
</Text>
</Text>
</Box>
<Box flexShrink={0} justifyContent="flex-end">
<Text>
<Text color="success">
+
{added15}
</Text>
{" "}
<Text color="error">
−
{removed15}
</Text>
</Text>
</Box>
</Box>
<Text dimColor>
partial: git output was cut
</Text>
</Box>
<Box flexDirection="row" justifyContent="space-between">
<Box flexShrink={0} marginLeft={0}>
<Button plain label={`${toggleLabel}`} />
<Text color="warning">
{" ✎"}
</Text>
</Box>
<Box flexShrink={1} marginLeft={2}>
<Text wrap="truncate">
<Text dimColor>
{" · "}
</Text>
<Text dimColor>
{LABELS}
{" "}
</Text>
<Text color="success">
+
{added16}
</Text>
{" "}
<Text color="error">
−
{removed16}
</Text>
<Text dimColor>
{" · "}
</Text>
<Text dimColor>
{LABELS2}
{" "}
</Text>
<Text color="success">
+
{added17}
</Text>
{" "}
<Text color="error">
−
{removed17}
</Text>
<Text dimColor>
{" · "}
</Text>
<Text dimColor>
{LABELS3}
{" "}
</Text>
<Text color="success">
+
{added18}
</Text>
{" "}
<Text color="error">
−
{removed18}
</Text>
</Text>
</Box>
</Box>
{await next(e)}
</Box>
)
})
}
The mod's own code
Shown under the mod's licence (MIT); its text is below. Keep the notice if you copy these lines.
loc-split/hooks/register.ts lines 207–225 · Band
on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
if (e.props.hasSurvey) return next(e)
if (e.surface !== 'terminal' && e.surface !== 'desktop') return next(e)
const r = (await $.state.get(REPORT)).value ?? null
if (r === null) return next(e)
const isOpen = (await $.state.get(IS_EXPANDED)).value ?? false
const offset = (await $.state.get(SCROLL)).value ?? 0
const { Box, Button, Text } = $.ui.resolve(e)
return drawBand(
{ Box, Button, Text },
r,
{ isOpen, offset, surface: e.surface, bodyColumns: e.props.bodyColumns, maxRows: e.props.maxRows },
{
toggle: () => void toggleExpanded($),
scrollBy: (by, lastOffset) => void scrollBy($, by, lastOffset),
},
)
})loc-split/hooks/band.tsx lines 131–280 · Band
export function drawBand(ui: BandUi, r: LocReport, view: BandView, actions: BandActions) {
const { Box, Button, Text } = ui
const { isOpen } = view
const counts = (count: LocCount) =>
isZero(count)
? [<Text dimColor>·</Text>]
: [
count.added > 0 && <Text color="success">+{count.added}</Text>,
count.added > 0 && count.removed > 0 && ' ',
count.removed > 0 && <Text color="error">−{count.removed}</Text>,
]
const shown = changed(r.net)
const isDirty = !isEmptySplit(r.uncommitted)
// The terminal draws the band's collapse mark at its edge; the desktop does not.
const chrome = view.surface === 'terminal' ? BAND_CHROME : 0
const fit = fitFor(r, view.bodyColumns - chrome - 2 * PADDING)
const summary = (
<Box flexDirection="row" justifyContent="space-between">
<Box flexShrink={0} marginLeft={view.surface === 'desktop' ? -BUTTON_INSET : 0}>
<Button key="toggle" plain label={toggleLabel(r, fit, isOpen)} onPress={actions.toggle} />
{isDirty && <Text color="warning"> ✎</Text>}
</Box>
<Box flexShrink={1} marginLeft={2}>
<Text wrap="truncate">
{shown.length === 0 ? (
<Text dimColor>no changes</Text>
) : (
shown.map((category, i) => [
i > 0 && <Text dimColor> · </Text>,
<Text dimColor>{LABELS[category][fit.isShort ? 'short' : 'full']} </Text>,
counts(countFor(r.net[category], fit)),
])
)}
</Text>
</Box>
</Box>
)
if (!isOpen) {
return (
<Box key="loc-split" flexDirection="column" paddingLeft={PADDING} paddingRight={PADDING + chrome}>
{summary}
</Box>
)
}
const { columns, names, widths, label } = layout(r, view.bodyColumns - chrome - 2 * PADDING - SCROLLBAR_CELLS)
// Each cell is a box of fixed width, so the columns line up in a
// proportional font (the desktop) as well as in a terminal's grid.
const cells = (split: LocSplit) =>
columns.map((column, i) => (
<Box width={(widths[i] ?? 0) + GAP} flexShrink={0} justifyContent="flex-end">
<Text>{counts(split[column])}</Text>
</Box>
))
const tableRow = (head: RenderChildren, split: LocSplit, marginTop = 0, bar?: RenderChildren) => (
<Box flexDirection="row" marginTop={marginTop}>
<Box width={label} flexGrow={1} flexShrink={1} minWidth={0} overflow="hidden">
{head}
</Box>
{cells(split)}
{bar}
</Box>
)
const older = r.commitCount - r.commits.length
const fixed = FIXED_ROWS + (isDirty ? 1 : 0) + (older > 0 ? 1 : 0)
const room = view.maxRows - fixed
const listRows = Math.max(2, Math.min(LIST_ROWS, room))
const canScroll = r.commits.length > listRows
const lastOffset = Math.max(0, r.commits.length - listRows)
const offset = Math.min(view.offset, lastOffset)
const visible = r.commits.slice(offset, offset + listRows)
const page = Math.max(1, listRows - 1)
// A scroll bar beside the list: an arrow above and below a track of dots
// whose bright run is as long, and sits as far down, as the window over
// the commits. Dots, centered, read the same in a terminal's grid and in
// the desktop's proportional font, where line glyphs never join up.
const thumb = Math.max(1, Math.round((listRows * listRows) / Math.max(1, r.commits.length)))
const thumbAt = lastOffset === 0 ? 0 : Math.round((offset / lastOffset) * (listRows - thumb))
const barCell = (child: RenderChildren) => (
<Box width={SCROLLBAR_CELLS} flexShrink={0} justifyContent="center">
{child}
</Box>
)
const track = (row: number) =>
canScroll &&
barCell(row >= thumbAt && row < thumbAt + thumb ? <Text>•</Text> : <Text dimColor>·</Text>)
return (
<Box key="loc-split" flexDirection="column" paddingLeft={PADDING} paddingRight={PADDING + chrome}>
<Box flexDirection="column" marginBottom={1}>
<Box flexDirection="row" justifyContent="space-between">
<Text bold wrap="truncate">
{titleOf(r)}
</Text>
{canScroll && (
<Box flexShrink={0} marginLeft={2}>
<Text dimColor>
{offset + 1}–{offset + visible.length} of {r.commits.length}
</Text>
</Box>
)}
</Box>
<Box flexDirection="row">
<Box width={label} flexGrow={1} flexShrink={1} />
{names.map((name, i) => (
<Box width={(widths[i] ?? 0) + GAP} flexShrink={0} justifyContent="flex-end">
<Text dimColor>{name}</Text>
</Box>
))}
{canScroll &&
barCell(<Button key="up" plain dimColor={offset === 0} label="↑" onPress={() => actions.scrollBy(-page, lastOffset)} />)}
</Box>
{visible.map((one, row) =>
tableRow(
<Box flexDirection="row" minWidth={0} overflow="hidden">
<Box width={SHA_CELLS} flexShrink={0}>
<Text dimColor>{one.sha}</Text>
</Box>
<Box flexShrink={1} minWidth={0} overflow="hidden" marginRight={1}>
<Text wrap="truncate-end">{one.subject}</Text>
</Box>
</Box>,
one.split,
0,
track(row),
),
)}
{canScroll && (
<Box flexDirection="row">
<Box flexGrow={1} />
{barCell(<Button key="down" plain dimColor={offset === lastOffset} label="↓" onPress={() => actions.scrollBy(page, lastOffset)} />)}
</Box>
)}
{older > 0 && (
<Text dimColor>
… {older} older commit{older === 1 ? '' : 's'} not listed
</Text>
)}
{isDirty && tableRow(<Text color="warning">✎ uncommitted</Text>, r.uncommitted)}
{tableRow(<Text bold>Σ net vs {shortRef(r.base)}</Text>, r.net, canScroll ? 0 : 1)}
{r.isPartial && <Text dimColor>partial: git output was cut</Text>}
</Box>
{summary}
</Box>
)
}Licence text (MIT)
MIT License Copyright (c) 2026 Roman Hotsiy Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
What its code calls
runs programsreads filestool callsremembers
The design, read from code
Drawn from the mod's source at the commit read, not from a run: a list is drawn three times, a condition takes its first branch that draws in the desktop app, and a value only the run time knows is shown as a made-up sample (dotted underline) or left out. Colours and type are this site's.
What its code shows
Read from the source at commit 204a8da7c0ed on 2026-10-06. The first group decides whether a mod is listed; the rest is for you to weigh. A later commit is not read until the next crawl.
| Decides the listing: code you can check | |
|---|---|
| Entry read | Every module hooks/hooks.json names was read.loc-split/hooks/register.ts |
| Parses | Every file parses as TypeScript or JavaScript.4 files parsed |
| All its code is in the mod | Every import is a file of the mod or the engine's own module; no packages, no require.all its code is in the mod |
| Readable | No minified lines, no eval or new Function, no import of a computed path, no encoded blobs.no minified code, no eval, no encoded blobs |
| Calls in the open | Network and programs are reached as $.http.fetch and $.process.run in place, never passed around.every call outside goes through $ in the open |
| For you to weigh before installing | |
| Where it draws | The terminal, the desktop app, both, or nothing (hooks only: a guard or a prompt rewriter), as its code says. Shown, never a reason to leave a mod out.draws in the terminal and the desktop app, with its own branch for the desktop |
| Install line | Whether its repository's own .claude-plugin/marketplace.json lists it, so it installs from that marketplace with the lines on its page.listed in its repository's .claude-plugin/marketplace.json: installs from there |
| Programs on Windows | Whether every program it starts through $.process exists on Windows (tail, date, open, osascript, /usr/… do not).runs no program a Windows PC lacks |
| Network | Whether every fetch names its https host in the code.no network |
| Programs | Whether every program it starts is named in the code and is not a shell, an interpreter or a network tool.loc-split/hooks/register.ts:99 a program named at run time; loc-split/hooks/register.ts:104 a program named at run time; loc-split/hooks/register.ts:105 a program named at run time; loc-split/hooks/register.ts:106 a program named at run time; loc-split/hooks/register.ts:107 a program named at run time |
| Reads and sends | Whether it both reads files or environment variables and reaches the network.reads files and reaches the network |
| Keys in the source | Whether the source holds what looks like an API key or a private key.no keys in the source |
| Licence | An open licence (MIT, Apache-2.0, BSD, ISC, Unlicense, 0BSD, CC0) with its text lets modscode show its code; otherwise the code is linked.MIT |
This is a reading of the code text, not a security review: it does not run the mod, and it cannot see what a program the mod starts does. The check before installing is yours. How mods are chosen
Install it
Check it yourself before you install it. Mods run unsandboxed, with your permissions, and modscode does not vouch for what this code does. Read the code below (or run claude plugin validate . in its folder), weigh what it reaches, and install the commit you read.
Its repository is its marketplace. Add that marketplace (in the terminal with these commands, or in the desktop app's plugin settings) and install the mod from it:
/plugin marketplace add RomanHotsiy/claude-mods/plugin install loc-split@claude-modsThis installs the marketplace's latest commit, which may not be the one read here (204a8da7c0ed). Compare them before you install.
Ask Claude about it
With the modscode connector added, Claude can read this design, what its code reaches and its code, and build on them. Ask it like this:
Read the modscode design "romanhotsiy-loc-split" with its code and make me a pane like itSearch them from Claude: the MCP connector
Similar designs
-
Ask Claude…Blast RadiusBlast Radius: npm testWould Cancel. Proceed Proceed ProceedProceed 1Cancel 2
-
Ask Claude…Replay TheaterReplay Theater 31 31 31src/app.ts (step 01 of 3)● Write● Write● WritePrev pNext nClose q
-
Ask Claude…2h 10m · █████░░░✓ build ✓ build ✓ buildJavaKotlin3 Python■ ok 3 ■ ok 3 ■ ok 3 Razor proven 3 Razor proven 3 Razor proven 3Phases ──────── 3/3build Pythonbuild Pythonbuild Python… 3 more phasesLua ──────── 3/Kotlin■ the whole upgrade Ruby■ build build Ruby■ build build Ruby■ build build Ruby … 3 moreNext ──────── PythonRuby (by hand)Podsclick a button, or ctrl+x tab then Tab, EnterAttention ──────── 3! Scala ! Scala ! Scala … 3 moreSession ──────── okJava
-
What it does
- Draws a band above the prompt
- Adds /seo-spend, /seo-doctor, /seo-cockpit
- Watches Agent calls and can refuse them
- Hooks agent.spawn, classic.SessionStart, prompt.submit, session.compact and 3 more
-
could not fill the prompt boxcould not fill:Ask Claude…
-
▴Token OptimizerCheckpointCheckpointCheckpointbuildStart freshbuildStart freshbuildStart freshbuildCheckpointCheckpointCheckpointCheckpointCheckpointCheckpointCheckpointCheckpointCheckpointbuildbuildbuildTokens savedSaved Clean up tokens in 30 days (chat 2 this session)Ask Claude…