modscode JA

modscode / Gallery / source-control

source-control

Source Control for Claude Code: Git status above the chat box, a panel with changes, commit, a history graph, branches and worktrees, plus fetch, pull, push and sync in one click. English and German.

Code you can checkTerminal + desktopPaneBandToastBoxButtonInputLinkText

What it does

  • Draws a band above the prompt, a pane
  • Watches tool calls and can refuse them
  • Hooks config.describe, session.start, turn.complete, ui.close
  • 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)

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

// Drawn like source-control by manuel-will (pane, band, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/manuel-will-source-control/
// 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 cutEnd = '…'
    const behind = '…'
    const ahead = '…'
    const changes = '…'
    const operation = '…'
    const unpublished = '…'
    const busy = '…'
    const text = '…'
    return (
      <Box flexDirection="column">
        <Box flexDirection="row" width="100%" paddingRight={4}>
          <Box flexShrink={1}>
            <Box flexDirection="row" alignItems="center">
              ⎇
              <Text wrap="truncate-end">
                <Text bold>
                  {cutEnd}
                </Text>
                <Text color="warning">
                  {` ${behind}↓`}
                </Text>
                <Text color="suggestion">
                  {` ${ahead}↑`}
                </Text>
                <Text>
                  {`  ✎ ${changes}`}
                </Text>
              </Text>
              <Box flexDirection="row" alignItems="center" marginLeft={2}>
                ✎
                <Text>
                  {`${changes}`}
                </Text>
              </Box>
              <Text wrap="truncate-end">
                <Text color="success">
                  {" ✓"}
                </Text>
                <Text color="error">
                  {` · ${operation}`}
                </Text>
                <Text color="inactive">
                  {` · ${unpublished}`}
                </Text>
                <Text color="inactive">
                  {` · ${busy}`}
                </Text>
                <Text color="warning">
                  {` · ${text}`}
                </Text>
              </Text>
            </Box>
          </Box>
          <Box flexGrow={1} />
          <Box marginLeft={1}>
            <Box flexDirection="row">
              <Button variant="primary">
                {" "}
              </Button>
            </Box>
          </Box>
          <Box marginLeft={1}>
            <Button plain>
              ◨
            </Button>
          </Box>
        </Box>
        {await next(e)}
      </Box>
    )
  })

  // the pane: open it with $.ui.open({ id: 'my-pane', title: "source-control" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text, Button, Input } = $.ui.resolve(e)
    const titleNarrow = '…'
    const branchTextOf = '…'
    const upstream = '…'
    const behind = '…'
    const ahead = '…'
    const checked = '…'
    const name = '…'
    const address = '…'
    const worktreeOf = '…'
    const operation = '…'
    const fetchFailed = '…'
    const text = '…'
    const messagePlaceholder = '…'
    const hooksHint = '…'
    return (
      <Box flexDirection="column" paddingX={1} paddingTop={1}>
        <Box flexDirection="row" paddingRight={0}>
          <Text bold>
            {titleNarrow}
          </Text>
          <Box flexGrow={1} />
          <Box flexDirection="row" alignItems="center" marginLeft={2}>
            ↻
            <Button plain dimColor />
          </Box>
          <Box flexDirection="row" alignItems="center" marginLeft={2}>
            ↓
            <Button plain dimColor />
          </Box>
          <Box flexDirection="row" alignItems="center" marginLeft={2}>
            ↑
            <Button plain dimColor />
          </Box>
        </Box>
        <Box flexDirection="row" alignItems="center">
          ⎇
          <Text wrap="truncate-end">
            <Text bold>
              {branchTextOf}
            </Text>
            <Text>
              <Text color="inactive">
                {" → "}
              </Text>
              <Text color="merged">
                {upstream}
              </Text>
            </Text>
            <Text color="warning">
              {` ${behind}↓`}
            </Text>
            <Text color="suggestion">
              {` ${ahead}↑`}
            </Text>
            <Text color="warning">
              {` · ${checked}`}
            </Text>
          </Text>
        </Box>
        <Box flexDirection="row">
          <Box flexShrink={0}>
            <Text dimColor>
              {`${name} ·`}
            </Text>
          </Box>
          <Box marginLeft={1} flexShrink={1}>
            <Text dimColor wrap="truncate-end">
              {address}
            </Text>
          </Box>
        </Box>
        <Text dimColor wrap="truncate-end">
          {worktreeOf}
        </Text>
        <Text color="error" wrap="wrap">
          {operation}
        </Text>
        <Text color="warning" wrap="wrap">
          {fetchFailed}
        </Text>
        <Text wrap="wrap">
          {text}
        </Text>
        <Box flexDirection="row">
          <Button />
        </Box>
        <Text dimColor wrap="truncate-end">
          ────────
        </Text>
        <Input placeholder={`${messagePlaceholder}`} submitLabel="commit" autoFocus />
        <Box flexDirection="row" marginTop={0} />
        <Text dimColor wrap="truncate-end">
          {hooksHint}
        </Text>
      </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.

source-control/hooks/register.tsx lines 848–865 · Band
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    bandDraws += 1
    bandSurfaces.add(e.surface)

    if (e.props.hasSurvey) {
      return next(e)
    }

    const [probe, snapshot, view] = await Promise.all([read($, PROBE), read($, SNAPSHOT), read($, VIEW)])

    if (probe !== 'repo' || snapshot === null) {
      return next(e)
    }

    const kit = kitOf($.ui.resolve(e), e.surface, e.props.bodyColumns)

    return bandView(kit, snapshot, view ?? INITIAL_VIEW, handlers, staleAfterMs)
  })
source-control/hooks/ui/band.tsx lines 147–182 · Band
export function bandView(
  kit: Kit,
  snapshot: ScSnapshot,
  view: ScView,
  handlers: Handlers,
  staleAfterMs: number,
): RenderElement {
  const { Box, Button } = kit
  const primary: Primary | null = primaryOf(snapshot)
  const isNarrow = kit.columns < NARROW_COLUMNS
  const isBusy = view.busy !== null

  const primaryLabel = primary === null ? '' : isNarrow ? primary.short : primary.label
  const busyLabel = view.busy ?? ''

  return (
    <Box flexDirection="row" width="100%" paddingRight={kit.surface === 'terminal' ? ENGINE_MARK_COLUMNS : 0}>
      <Box flexShrink={1}>{statusText(kit, snapshot, view, staleAfterMs)}</Box>
      <Box flexGrow={1} />
      {primary !== null && (
        <Box marginLeft={1}>
          {primaryButton(kit, 'primary', isBusy ? null : primary.icon, isBusy ? busyLabel : primaryLabel, () => {
            if (!isBusy) {
              handlers.primary(primary.kind)
            }
          }, isBusy)}
        </Box>
      )}
      <Box marginLeft={1}>
        <Button key="panel" plain dimColor={!view.isPaneOpen} onPress={() => handlers.togglePane()}>
          {GLYPH.panel}
        </Button>
      </Box>
    </Box>
  )
}
source-control/hooks/ui/band.tsx lines 93–134 · Band
function statusText(kit: Kit, snapshot: ScSnapshot, view: ScView, staleAfterMs: number): RenderElement {
  const { Text } = kit
  const isNarrow = kit.columns < NARROW_COLUMNS
  const changes = changeCountOf(snapshot)
  const operation = operationTextOf(snapshot)
  const freshness = isNarrow ? null : freshnessOf(snapshot, view, staleAfterMs)
  const isUnpublished = snapshot.upstream === null && snapshot.branch !== null && snapshot.remoteName !== null && !snapshot.isUnborn
  const branchRoom = Math.max(8, Math.floor(kit.columns / 3))

  const { Box } = kit

  // the desktop draws the pencil as an icon (the glyph is an emoji there),
  // so the line breaks into the text before it and the text after it
  const hasIcons = kit.Svg !== null

  return (
    <Box flexDirection="row" alignItems="center">
      {icon(kit, 'branch', 'muted', COLOR.muted)}
      <Text wrap="truncate-end">
        <Text bold>{cutEnd(clean(branchTextOf(snapshot)), branchRoom)}</Text>
        {snapshot.behind > 0 && <Text color={COLOR.behind}>{` ${snapshot.behind}${GLYPH.behind}`}</Text>}
        {snapshot.ahead > 0 && <Text color={COLOR.ahead}>{` ${snapshot.ahead}${GLYPH.ahead}`}</Text>}
        {changes > 0 && !hasIcons && <Text>{`  ${GLYPH.changes} ${changes}`}</Text>}
      </Text>
      {changes > 0 && hasIcons && (
        <Box flexDirection="row" alignItems="center" marginLeft={2}>
          {icon(kit, 'edit', 'muted')}
          <Text>{`${changes}`}</Text>
        </Box>
      )}
      <Text wrap="truncate-end">
        {isConfirmedSettled(snapshot, view, staleAfterMs) && <Text color={COLOR.ok}>{` ${GLYPH.clean}`}</Text>}
        {operation !== null && <Text color={COLOR.error}>{` · ${operation}`}</Text>}
        {isUnpublished && !isNarrow && <Text color={COLOR.muted}>{` · ${t().unpublished}`}</Text>}
        {view.busy !== null && <Text color={COLOR.muted}>{` · ${view.busy}`}</Text>}
        {view.busy === null && freshness !== null && (
          <Text color={freshness.isWarning ? COLOR.warn : COLOR.muted}>{` · ${freshness.text}`}</Text>
        )}
      </Text>
    </Box>
  )
}
source-control/hooks/ui/band.tsx lines 50–87 · Band
export function primaryButton(
  kit: Kit,
  key: string,
  iconName: IconName | null,
  label: string,
  onPress: () => void,
  isBusy: boolean,
  isWide = false,
): RenderElement {
  const { Box, Button } = kit

  // the app's own button keeps the app's size, next to its neighbours
  if (kit.surface !== 'terminal') {
    return (
      <Box flexDirection="row">
        <Button key={key} variant="primary" dimColor={isBusy} onPress={onPress}>
          {label === '' ? ' ' : label}
        </Button>
      </Box>
    )
  }

  const shown = iconName !== null ? [glyphOf(iconName), label].filter(part => part !== '').join(' ') : label

  return (
    <Box
      flexDirection="row"
      alignItems="center"
      backgroundColor={VSCODE_BLUE}
      paddingX={1}
      {...(isWide ? { flexGrow: 1, justifyContent: 'center' as const } : {})}
    >
      <Button key={key} plain dimColor={isBusy} onPress={onPress}>
        {shown === '' ? ' ' : shown}
      </Button>
    </Box>
  )
}
source-control/hooks/register.tsx lines 867–875 · Pane
  on('ui.render', { component: 'Pane', requestId: PANE_ID }, async ($, e) => {
    paneDraws += 1
    paneSurfaces.add(e.surface)

    const [snapshot, view] = await Promise.all([read($, SNAPSHOT), read($, VIEW)])
    const kit = kitOf($.ui.resolve(e), e.surface, Math.max(10, e.props.bodyColumns - 2))

    return paneView(kit, snapshot, view ?? INITIAL_VIEW, handlers, staleAfterMs, e.props.placement === 'dock')
  })
source-control/hooks/ui/pane.tsx lines 586–743 · Pane
export function paneView(
  kit: Kit,
  snapshot: ScSnapshot | null,
  view: ScView,
  handlers: Handlers,
  staleAfterMs: number,
  isDocked: boolean,
): RenderElement {
  const { Box, Button, Text } = kit
  const isBusy = view.busy !== null
  const isFolded = (id: string) => view.folded.includes(id)
  const top = headerRow(kit, handlers, isBusy, isDocked)
  // the terminal draws a docked pane's close mark in its first row; the
  // desktop puts it in a title bar of its own
  const hasMarkRow = isDocked && kit.Svg === null

  if (snapshot === null) {
    return (
      <Box flexDirection="column" paddingX={1} paddingTop={hasMarkRow ? 1 : 0}>
        {top}
        {dimLine(kit, t().noRepository)}
      </Box>
    )
  }

  const details = snapshot.details
  const conflictCount = snapshot.conflicts.length

  const operation =
    snapshot.operation !== null
      ? `${t().operationRunning(OPERATION_NAMES[snapshot.operation])} · ${conflictCount > 0 ? t().conflicts(conflictCount) : t().allConflictsResolved}`
      : operationTextOf(snapshot)
  const notice = view.notice
  const noticeColor = notice?.tone === 'error' ? COLOR.error : notice?.tone === 'success' ? COLOR.ok : COLOR.muted
  const target = snapshot.branch ?? 'HEAD'
  // the message field only while there is something to commit (or a merge
  // to conclude), so a clean repository shows no commit control at all
  const canCommit = changeCountOf(snapshot) > 0 || snapshot.operation === 'merge'
  const { Input } = kit

  const sections: (RenderElement | null | false)[] = []

  if (snapshot.conflicts.length > 0) {
    sections.push(sectionHeader(kit, handlers, 'conflicts', t().conflictsSection, snapshot.conflicts.length, isFolded('conflicts')))

    if (!isFolded('conflicts')) {
      sections.push(dimLine(kit, t().conflictsHint))
      sections.push(...snapshot.conflicts.map(file => fileRow(kit, handlers, file, 'stage')))
    }
  }

  if (snapshot.staged.length > 0) {
    sections.push(
      sectionHeader(
        kit,
        handlers,
        'staged',
        t().stagedSection,
        snapshot.staged.length,
        isFolded('staged'),
        <Button key="unstage-all" plain dimColor onPress={() => handlers.act('unstageAll')}>
          {`${GLYPH.unstage} ${t().all}`}
        </Button>,
      ),
    )

    if (!isFolded('staged')) {
      sections.push(...snapshot.staged.map(file => fileRow(kit, handlers, file, 'unstage')))
    }
  }

  sections.push(
    sectionHeader(
      kit,
      handlers,
      'changes',
      t().changesSection,
      snapshot.unstaged.length,
      isFolded('changes'),
      snapshot.unstaged.length > 0 ? (
        <Button key="stage-all" plain dimColor onPress={() => handlers.act('stageAll')}>
          {`${GLYPH.stage} ${t().all}`}
        </Button>
      ) : null,
    ),
  )

  if (!isFolded('changes')) {
    sections.push(
      ...(snapshot.unstaged.length > 0
        ? snapshot.unstaged.map(file => fileRow(kit, handlers, file, 'stage'))
        : [dimLine(kit, changeCountOf(snapshot) === 0 ? `${t().noChanges} ${GLYPH.clean}` : conflictCount > 0 ? t().noOtherChanges : t().allStaged)]),
    )
  }

  sections.push(sectionHeader(kit, handlers, 'history', t().historySection, null, isFolded('history')))

  if (!isFolded('history')) {
    sections.push(...historyRows(kit, snapshot))
  }

  if (details !== null) {
    sections.push(sectionHeader(kit, handlers, 'branches', t().branchesSection, details.branches.length, isFolded('branches')))

    if (!isFolded('branches')) {
      sections.push(...details.branches.map(branch => branchRow(kit, branch, view.fetchError === null)))
    }

    if (details.worktrees.length > 1) {
      sections.push(sectionHeader(kit, handlers, 'worktrees', t().worktreesSection, details.worktrees.length, isFolded('worktrees')))

      if (!isFolded('worktrees')) {
        sections.push(...details.worktrees.map(tree => worktreeRow(kit, tree)))
      }
    }

    if (details.stashes.length > 0) {
      sections.push(sectionHeader(kit, handlers, 'stashes', t().stashesSection, details.stashes.length, isFolded('stashes')))

      if (!isFolded('stashes')) {
        sections.push(...details.stashes.map(stash => stashRow(kit, stash)))
      }
    }
  }

  return (
    <Box flexDirection="column" paddingX={1} paddingTop={hasMarkRow ? 1 : 0}>
      {top}
      {infoRow(kit, snapshot, view, staleAfterMs)}
      {details?.remote != null && remoteRow(kit, snapshot.remoteName ?? 'remote', details.remote)}
      {snapshot.isLinkedWorktree && dimLine(kit, t().worktreeOf(shortPathOf(snapshot.commonDir.replace(/[\\/]\.git[\\/]?$/, ''))))}
      {operation !== null && <Text color={conflictCount > 0 ? COLOR.error : COLOR.warn} wrap="wrap">{operation}</Text>}
      {view.fetchError !== null && <Text color={COLOR.warn} wrap="wrap">{t().fetchFailed(view.fetchError)}</Text>}
      {notice !== null && notice.text !== view.fetchError && <Text color={noticeColor} wrap="wrap">{notice.text}</Text>}
      {notice?.retry === 'autostash' && !isBusy && (
        <Box flexDirection="row">
          <Button key="retry-autostash" onPress={() => handlers.act('pullAutostash')}>
            {t().pullAutostash}
          </Button>
        </Box>
      )}
      {kit.Svg === null ? rule(kit) : <Box marginTop={1} />}
      {Input !== null && canCommit && (
        <Input
          key={`message-${view.commitField}`}
          placeholder={t().messagePlaceholder(target)}
          submitLabel={kit.Svg === null ? 'commit' : '↵'}
          autoFocus
          onInput={value => handlers.draft(value)}
          onSubmit={value => handlers.commit(value)}
        />
      )}
      {actionRow(kit, snapshot, view, handlers)}
      {details?.hasHooks === true && dimLine(kit, t().hooksHint)}
      {sections}
    </Box>
  )
}
Licence text (MIT)
MIT License

Copyright (c) 2026 manuel-will

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 programswrites filesenv varsdrives Claudetool callsremembers

What its code shows

Read from the source at commit f70a2b680b13 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.source-control/hooks/register.tsx
ParsesEvery file parses as TypeScript or JavaScript.14 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.source-control/hooks/register.tsx:77 a program named at run time
Reads and sendsWhether it both reads files or environment variables and reaches the network.reaches no 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 manuel-will/cc-source-control
/plugin install source-control@cc-source-control

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

Search them from Claude: the MCP connector

Similar designs