modscode / Gallery / multirepo-diff-mod
multirepo-diff-mod
/multi-diff: a worktree-aware diff viewer for every git repo in your project folder, with uncommitted, staged, pull request and since-this-session views
What it does
- Draws a pane
- Watches Edit, MultiEdit, Write, NotebookEdit calls
- Hooks session.start, ui.press, ui.select
- Keeps its own state between turns
- Starts processes
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 multirepo-diff-mod by Sravan (pane), as modscode read it from the mod's code:
// https://modscode.com/gallery/nvsravank-multirepo-diff-mod/
// 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 pane: open it with $.ui.open({ id: 'my-pane', title: "Multi-repo diff" })
on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
const { Box, Button, Text, Select } = $.ui.resolve(e)
const name = '…'
const value = '…'
const label = '…'
const fileCount = '…'
const about = '…'
const problem = '…'
const empty = '…'
const baseName = '…'
const treeStart = '…'
const length = '…'
const letter = '…'
const letter2 = '…'
const letter3 = '…'
const added = '…'
const removed = '…'
const start = '…'
return (
<Box flexDirection="column" gap={1}>
<Box flexDirection="column" gap={1}>
<Box flexDirection="row" justifyContent="space-between" alignItems="center">
<Box flexDirection="row" gap={2} alignItems="center" flexShrink={1}>
<Button plain>
☰
</Button>
<Text bold>
{name}
</Text>
</Box>
<Box flexDirection="row" gap={1} alignItems="center">
<Button plain>
⟳
</Button>
<Button plain>
☾
</Button>
</Box>
</Box>
<Box flexDirection="row" gap={2} alignItems="center">
<Select label="Worktree: " value={`${value}`} />
<Button plain dimColor>
Hide detached
</Button>
</Box>
<Box flexDirection="row" justifyContent="space-between" alignItems="center">
<Text dimColor>
{label}
</Text>
<Text dimColor>
{fileCount}
</Text>
</Box>
<Text dimColor>
{about}
</Text>
</Box>
<Text color="red">
{problem}
</Text>
<Text dimColor>
{empty}
{" in "}
{baseName}
.
</Text>
<Box flexDirection="row" gap={2}>
<Box flexDirection="column" flexShrink={0}>
<Box flexDirection="row" gap={1} alignItems="center">
<Button plain>
◀
</Button>
<Text dimColor>
{`${treeStart}1–${treeStart}${length} of ${length}`}
</Text>
<Button plain>
▶
</Button>
</Box>
<Box flexDirection="row" gap={1}>
<Text color="gray" bold>
{letter}
</Text>
<Button plain />
</Box>
<Box flexDirection="row" gap={1}>
<Text color="gray" bold>
{letter2}
</Text>
<Button plain />
</Box>
<Box flexDirection="row" gap={1}>
<Text color="gray" bold>
{letter3}
</Text>
<Button plain />
</Box>
</Box>
<Box width={1} flexShrink={0} />
<Box flexDirection="column" flexGrow={1} flexShrink={1}>
<Box flexDirection="row" gap={1} marginBottom={1}>
<Text bold wrap="truncate-middle">
{" "}
</Text>
<Text>
{`+${added}`}
</Text>
<Text>
{`-${removed}`}
</Text>
</Box>
<Box flexDirection="column" gap={1}>
<Box flexDirection="column" gap={1}>
<Box flexDirection="row" gap={2} alignItems="center">
<Button>
◀ Previous
</Button>
<Text dimColor>
{`Rows ${start}1–${start}${length} of ${length}`}
</Text>
<Button>
Next ▶
</Button>
</Box>
<Box flexDirection="column" />
<Box flexDirection="row" gap={2} alignItems="center">
<Button>
◀ Previous
</Button>
<Text dimColor>
{`Rows ${start}1–${start}${length} of ${length}`}
</Text>
<Button>
Next ▶
</Button>
</Box>
</Box>
<Text dimColor>
Diff truncated: too large to show in full.
</Text>
</Box>
</Box>
</Box>
</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.
hooks/register.tsx lines 580–739 · Pane
on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
const table = $.ui.resolve(e)
const { Box, Text, Button, Code } = table
// Mobile has no Select; it shows the repo name instead.
const Select = 'Select' in table ? table.Select : null
const [repoList, current, currentMode, about, list, selected, view, problem, where, isListHidden, foldedDirs, colorTheme, page, treeAt, trees, activeTree, isShowingDetached] =
await Promise.all([
read($, repos),
read($, repo),
read($, mode),
read($, note),
read($, files),
read($, file),
read($, diff),
read($, error),
read($, root),
read($, isListCollapsed),
read($, collapsedDirs),
read($, theme),
read($, diffPage),
read($, treePage),
read($, worktrees),
read($, worktree),
read($, showDetached),
])
const cols = e.props.bodyColumns || e.viewport?.columns || 100
const isWide = cols >= 70
const leftWidth = isWide ? Math.max(24, Math.min(48, Math.floor(cols * 0.3))) : cols
const active = repoList.find(one => one.path === current)
const modeInfo = MODES.find(one => one.value === currentMode) ?? MODES[0]
const repoOptions = repoList.map(one => ({ value: one.path, label: one.name }))
// Detached worktrees (no branch checked out, e.g. scratch checkouts) are
// hidden unless asked for. The main checkout always shows, and so does
// the worktree being viewed.
const detachedCount = trees.filter((one: Worktree, i: number) => i > 0 && !one.branch).length
const treeOptions = trees
.map((one: Worktree, i: number) => ({ one, i }))
.filter(({ one, i }) => i === 0 || one.branch || isShowingDetached || one.path === activeTree)
.map(({ one, i }) => ({
value: one.path,
label: `${i === 0 ? 'main checkout' : baseName(one.path)} — ${one.branch ?? `detached at ${one.sha}`}`,
}))
const fileCount = `${list.length} file${list.length === 1 ? '' : 's'} changed`
// Four rows: repo and pane controls; worktree; compare mode and count;
// what exactly is being compared.
const header = (
<Box flexDirection="column" gap={1}>
<Box flexDirection="row" justifyContent="space-between" alignItems="center">
<Box flexDirection="row" gap={2} alignItems="center" flexShrink={1}>
<Button key="files" plain onPress={() => void toggleList($)}>
☰
</Button>
{repoOptions.length > 0 && Select ? (
<Select
key="repo"
label="Repo: "
options={repoOptions}
value={current || repoOptions[0].value}
autoFocus
onSelect={value => void selectRepo($, value)}
/>
) : (
<Text bold>{active ? active.name : 'Multi-repo diff'}</Text>
)}
</Box>
<Box flexDirection="row" gap={1} alignItems="center">
<Button key="refresh" plain onPress={() => void refresh($)}>
⟳
</Button>
{/* Shows the mode a press switches to: ☾ while light, ☀ while dark. */}
{e.surface !== 'terminal' && (
<Button key="theme" plain onPress={() => void toggleTheme($)}>
{colorTheme === 'light' ? '☾' : '☀'}
</Button>
)}
</Box>
</Box>
{treeOptions.length > 0 && Select ? (
<Box flexDirection="row" gap={2} alignItems="center">
<Select
key="worktree"
label="Worktree: "
options={treeOptions}
value={activeTree || treeOptions[0].value}
onSelect={value => void showTree($, value)}
/>
{detachedCount > 0 && (
<Button key="detached" plain dimColor onPress={() => void toggleDetached($)}>
{isShowingDetached ? 'Hide detached' : `Show detached (${detachedCount})`}
</Button>
)}
</Box>
) : null}
<Box flexDirection="row" justifyContent="space-between" alignItems="center">
{Select ? (
<Select
key="mode"
label="Compare: "
options={MODES.map(({ value, label }) => ({ value, label }))}
value={currentMode}
onSelect={value => void setMode($, value as DiffMode)}
/>
) : (
<Text dimColor>{modeInfo.label}</Text>
)}
<Text dimColor>{fileCount}</Text>
</Box>
{about ? <Text dimColor>{about}</Text> : null}
</Box>
)
// Folders first, files under them; the letter in front is the git status.
// Paged like the diff, so a repo with many changed files can't push the
// drawing past the desktop's size limit.
const tree = toTree(list, new Set(foldedDirs))
const treePages = Math.ceil(tree.length / TREE_ROWS)
const treeStart = Math.min(treeAt, Math.max(0, treePages - 1)) * TREE_ROWS
const treeShown = tree.slice(treeStart, treeStart + TREE_ROWS)
const fileList = (
<Box flexDirection="column" width={leftWidth} flexShrink={0}>
{treePages > 1 && (
<Box flexDirection="row" gap={1} alignItems="center">
{treeStart > 0 && (
<Button key="tree-prev" plain onPress={() => void turnTreePage($, -1)}>
◀
</Button>
)}
<Text dimColor>{`${treeStart + 1}–${treeStart + treeShown.length} of ${tree.length}`}</Text>
{treeStart + TREE_ROWS < tree.length && (
<Button key="tree-next" plain onPress={() => void turnTreePage($, 1)}>
▶
</Button>
)}
</Box>
)}
{treeShown.map(row => {
if (row.kind === 'dir') {
return (
<Box paddingLeft={row.depth * 2}>
<Button key={`dir:${row.path}`} plain dimColor onPress={() => void toggleDir($, row.path)}>
{`${row.isCollapsed ? '▸' : '▾'} ${row.name}`}
</Button>
</Box>
)
}
const letter = statusLetter(row.change.status)
const isOn = row.change.path === selected
return (
<Box flexDirection="row" gap={1} paddingLeft={row.depth * 2}>
<Text color={STATUS_COLOR[letter] ?? 'gray'} bold>
{letter}
</Text>
<Button key={`file:${row.change.path}`} plain dimColor={!isOn} onPress={() => void showFile($, row.change.path)}>
{row.name}
</Button>
</Box>Licence text (MIT)
MIT License Copyright (c) 2026 Sravan (nvsravank) 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 2acbd1732044 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.hooks/register.tsx |
| Parses | Every file parses as TypeScript or JavaScript.3 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, the same in both |
| 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.its repository's .claude-plugin/marketplace.json does not list it: no install line to give |
| 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.git (reaches the network) |
| 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's .claude-plugin/marketplace.json does not list it, so there is no install line to give. Read it as code, or follow its author's README.
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 "nvsravank-multirepo-diff-mod" with its code and make me a pane like itSearch them from Claude: the MCP connector
Similar designs
-
Ask Claude…Xcodebuild · App · 31/3◐ Rendering App…Write↻ Re-render (r) r✦ Ask Claude (x) x◀ (h) h▶ (l) lOpen (o) o
-
Ask Claude…Skins0 Your promptadd rate limiting to the hub api0 Tool rows: finished, running, failedYour prompt Spinner0 Folded group of reads and searches●main · note 3 · note 3 · note 30 Edit diff cardDesktop only; the terminal keeps Claude Code's diff.0 Shell output cardDesktop only.0 Code block cardDesktop only; the terminal keeps Claude Code's markdown.0 TableAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentCopyAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentCopyAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentCopy0 SpinnerAccent SpinnerSpinnerSpinner… 2h 10m0 Band above the prompt: normal, then nudging to compact█████░░░ 42% build█████░░░ 42% build█████░░░ 42% buildContext is 42% full0 Compact now0 Band above a questionTable BashBashBash0 Turn footer (terminal)3 build in 2h 10m · Grep · +3 −3
-
Ask Claude…agent-discoverbuildbuildbuildRefreshMCP Browse/3Tab / shift+Tab move · Enter presses · ↑↓ scroll · Esc back to the promptBrowse...Audit asks:DeclineAcceptDeclineCancelAudit asks:DeclineAcceptDeclineCancelAudit asks:DeclineAcceptDeclineCancel
-
What it does
- Adds /sage-memory
- Watches Bash calls and can refuse them
- Hooks agent.spawn, classic.PostToolBatch, classic.SessionStart, prompt.attachment and 9 more
- Keeps its own state between turns
-
Ask Claude…Fanyi settingsOnAPI · OpusenOn this MacAPIHost src/ SaveKey K · paste a new one, Enter SaveOpus↻ RefreshCustom model model id, for an API that lists none UseFanyi settingsHostClose
-
Ask Claude…Review plannerEXAMPLE · REVIEW PLANNINGPrepare a focused reviewDemo data and a manual checklist. No code has been inspected.Review scope Chat composer: draft handling and keyboard focuscorrectnessView example diffPreparation checklist42%✓Fix loginExample diffUndo✓Fix loginExample diffUndo✓Fix loginExample diffUndoPrepare review promptReset checklistPreparing a prompt only updates the draft. Nothing is sent.