modscode JA

modscode / Gallery / change-ledger

change-ledger

Lists the files this session edited in a pane (/changes), with line counts and who edited them, beside the git working tree

Code you can checkTerminal + desktopPaneBoxText

What it does

  • Draws a pane
  • Adds /changes
  • Watches Edit, Write calls
  • Hooks session.start, turn.complete
  • Starts processes

Good points

  • No network calls
  • Small: 265 lines
  • Written in TypeScript
  • Writes no files

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)

register.tsx
import type { Register } from 'claude-code'

// Drawn like change-ledger by Mehmet Aras (pane), as modscode read it from the mod's code:
// https://modscode.com/gallery/arasovic-change-ledger/
// 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: "Changes" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text } = $.ui.resolve(e)
    const t = '…'
    const t2 = '…'
    const t3 = '…'
    const more = '…'
    const t4 = '…'
    const t5 = '…'
    const t6 = '…'
    const t7 = '…'
    const t8 = '…'
    const t9 = '…'
    const t10 = '…'
    const t11 = '…'
    const t12 = '…'
    const length = '…'
    const t13 = '…'
    const t14 = '…'
    const t15 = '…'
    const t16 = '…'
    const t17 = '…'
    const t18 = '…'
    const t19 = '…'
    const t20 = '…'
    const t21 = '…'
    return (
      <Box flexDirection="column" paddingTop={1}>
        <Text>
          <Text>
            {t}
          </Text>
          <Text>
            {t2}
          </Text>
          <Text>
            {t3}
          </Text>
        </Text>
        <Box flexDirection="column" marginTop={1}>
          <Text>
            <Text dimColor>
              {"╭─ "}
            </Text>
            <Text bold>
              Edits
            </Text>
            <Text dimColor>
              {" "}
              ────────
            </Text>
            <Text dimColor>
              {" "}
              {`+${more} more`}
              {" "}
            </Text>
            <Text dimColor>
              ─╮
            </Text>
          </Text>
          <Text>
            <Text dimColor>
              {"│ "}
            </Text>
            <Text>
              {t4}
            </Text>
            <Text>
              {t5}
            </Text>
            <Text>
              {t6}
            </Text>
            <Text dimColor>
              {" │"}
            </Text>
          </Text>
          <Text>
            <Text dimColor>
              {"│ "}
            </Text>
            <Text>
              {t7}
            </Text>
            <Text>
              {t8}
            </Text>
            <Text>
              {t9}
            </Text>
            <Text dimColor>
              {" │"}
            </Text>
          </Text>
          <Text>
            <Text dimColor>
              {"│ "}
            </Text>
            <Text>
              {t10}
            </Text>
            <Text>
              {t11}
            </Text>
            <Text>
              {t12}
            </Text>
            <Text dimColor>
              {" │"}
            </Text>
          </Text>
          <Text dimColor>
            ╰
            ────────
            ╯
          </Text>
        </Box>
        <Box flexDirection="column" marginTop={1}>
          <Text>
            <Text dimColor>
              {"╭─ "}
            </Text>
            <Text bold>
              Working tree
            </Text>
            <Text dimColor>
              {" "}
              ────────
            </Text>
            <Text dimColor>
              {" "}
              {`${length} changed`}
              {" "}
            </Text>
            <Text dimColor>
              ─╮
            </Text>
          </Text>
          <Text>
            <Text dimColor>
              {"│ "}
            </Text>
            <Text>
              {t13}
            </Text>
            <Text>
              {t14}
            </Text>
            <Text>
              {t15}
            </Text>
            <Text dimColor>
              {" │"}
            </Text>
          </Text>
          <Text>
            <Text dimColor>
              {"│ "}
            </Text>
            <Text>
              {t16}
            </Text>
            <Text>
              {t17}
            </Text>
            <Text>
              {t18}
            </Text>
            <Text dimColor>
              {" │"}
            </Text>
          </Text>
          <Text>
            <Text dimColor>
              {"│ "}
            </Text>
            <Text>
              {t19}
            </Text>
            <Text>
              {t20}
            </Text>
            <Text>
              {t21}
            </Text>
            <Text dimColor>
              {" │"}
            </Text>
          </Text>
          <Text dimColor>
            ╰
            ────────
            ╯
          </Text>
        </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.

change-ledger/hooks/register.tsx lines 155–251 · Pane
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
    const { Box, Text } = $.ui.resolve(e)
    const list = await read($, files)
    const tree = await read($, git)
    const now = await $.clock.now()
    const cwd = await $.session.cwd()
    const w = Math.max(28, e.props.bodyColumns - 1)
    const inner = w - 6

    const draw = (row: Row, width: number) =>
      fit(row, width).map((s, j) => <Text key={String(j)} color={s.c} dimColor={s.d} bold={s.b}>{s.t}</Text>)
    const frame = (title: string, tone: string, rows: Row[], right = '') => {
      const rule = Math.max(0, w - 6 - title.length - (right ? right.length + 2 : 0))
      return (
        <Box key={title} flexDirection="column" marginTop={1}>
          <Text>
            <Text color={tone} dimColor>╭─ </Text>
            <Text color={tone} bold>{title}</Text>
            <Text color={tone} dimColor> {'─'.repeat(rule)}</Text>
            {right ? <Text dimColor> {right} </Text> : null}
            <Text color={tone} dimColor>─╮</Text>
          </Text>
          {rows.map((row, i) => (
            <Text key={String(i)}>
              <Text color={tone} dimColor>│  </Text>
              {draw(row, inner)}
              <Text color={tone} dimColor>  │</Text>
            </Text>
          ))}
          <Text color={tone} dimColor>╰{'─'.repeat(w - 2)}╯</Text>
        </Box>
      )
    }

    const name = (path: string) => path.split('/').pop() ?? path
    const dir = (path: string) => {
      const inside = path.startsWith(`${cwd}/`) ? path.slice(cwd.length + 1) : path
      const parts = inside.split('/').slice(0, -1)
      if (!parts.length) return './'
      return parts.length > 2 && !path.startsWith(`${cwd}/`) ? `…/${parts.slice(-2).join('/')}/` : `${parts.join('/')}/`
    }
    const counts = (added: number, removed: number): Row => [
      { t: `+${added}`.padStart(5), c: 'success' },
      { t: ` −${removed}`.padEnd(6), c: 'error' },
    ]

    const added = list.reduce((n, f) => n + f.added, 0)
    const removed = list.reduce((n, f) => n + f.removed, 0)
    const glance: Row = list.length
      ? [{ t: `${list.length} ${list.length === 1 ? 'file' : 'files'}  `, b: true }, { t: `+${added}`, c: 'success' }, { t: ` −${removed}`, c: 'error' }]
      : [{ t: 'No edits yet', d: true }]
    if (tree) glance.push({ t: `   ${tree.branch}`, c: 'suggestion' }, ...(tree.ahead ? [{ t: ` ↑${tree.ahead}`, d: true }] : []), ...(tree.behind ? [{ t: ` ↓${tree.behind}`, c: 'warning' }] : []))

    // The git frame lists every changed path: the ones this session edited get a filled dot, the rest (shell, you) an empty one.
    const touched = new Set(list.map(f => f.path))
    const GIT_MAX = 8
    const gitRows: Row[] = tree
      ? tree.files.length
        ? tree.files.slice(0, GIT_MAX).map(f => {
            const mine = touched.has(`${tree.root}/${f.path}`)
            const tone = f.status === '??' || f.status === 'A' ? 'success' : f.status === 'D' ? 'error' : 'warning'
            const right: Row = f.added === undefined ? [{ t: f.status === '??' ? 'new' : '', d: true }] : counts(f.added, f.removed ?? 0)
            return spread([{ t: mine ? '● ' : '○ ', c: mine ? 'suggestion' : undefined, d: !mine }, { t: f.status.padEnd(3), c: tone }, { t: f.path, d: !mine }], right, inner)
          })
        : [[{ t: 'Working tree clean.', d: true }]]
      : []
    if (tree && tree.files.length > GIT_MAX) gitRows.push([{ t: `+${tree.files.length - GIT_MAX} more`, d: true }])

    // Edits get the rows left after the top padding, the glance row and the git frame; each file takes two rows plus a blank between files.
    const fixed = 2 + 3 + (tree ? gitRows.length + 3 : 0)
    const room = Math.max(5, e.props.scroll.bodyRows - fixed)
    const shown = list.slice(0, Math.max(1, Math.floor((room + 1) / 3)))
    const max = Math.max(1, ...shown.map(f => f.added + f.removed))
    const editRows: Row[] = shown.length
      ? shown.flatMap((f, i) => {
          const bar = statBar(f.added, f.removed, max, 8)
          const top = spread(
            [{ t: name(f.path), b: true }, ...(f.created ? [{ t: ' new', c: 'success' }] : [])],
            [{ t: '■'.repeat(bar.plus), c: 'success' }, { t: '■'.repeat(bar.minus), c: 'error' }, { t: '·'.repeat(bar.rest), d: true }, ...counts(f.added, f.removed)],
            inner,
          )
          const sub = spread([{ t: `  ${dir(f.path)}`, d: true }], [{ t: `${f.agents.join(', ')} · ${f.edits}× · ${ago(now - f.at)}`, d: true }], inner)
          return i ? [[], top, sub] : [top, sub]
        })
      : [[{ t: 'Files Claude edits or writes show here.', d: true }]]
    const more = list.length - shown.length

    return (
      <Box flexDirection="column" paddingTop={1}>
        <Text>
          {draw(glance, w - 3)}
        </Text>
        {frame('Edits', 'suggestion', editRows, more > 0 ? `+${more} more` : '')}
        {tree ? frame('Working tree', tree.files.some(f => !touched.has(`${tree.root}/${f.path}`)) ? 'warning' : 'success', gitRows, `${tree.files.length} changed`) : null}
      </Box>
    )
  })
Licence text (MIT)
MIT License

Copyright (c) 2026 Mehmet Aras

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 filesdrives Claudetool calls

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 bfa1831e396b 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 readEvery module hooks/hooks.json names was read.change-ledger/hooks/register.tsx
ParsesEvery file parses as TypeScript or JavaScript.1 files parsed
All its code is in the modEvery import is a file of the mod or the engine's own module; no packages, no require.all its code is in the mod
ReadableNo 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 openNetwork 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 drawsThe 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 lineWhether 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 WindowsWhether every program it starts through $.process exists on Windows (tail, date, open, osascript, /usr/… do not).runs no program a Windows PC lacks
NetworkWhether every fetch names its https host in the code.no network
ProgramsWhether 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 sendsWhether it both reads files or environment variables and reaches the network.reads files and reaches the network
Keys in the sourceWhether the source holds what looks like an API key or a private key.no keys in the source
LicenceAn 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 arasovic/claude-code-mods
/plugin install change-ledger@claude-code-mods

This installs the marketplace's latest commit, which may not be the one read here (bfa1831e396b). 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 "arasovic-change-ledger" with its code and make me a pane like it

Search them from Claude: the MCP connector

Similar designs