modscode JA

modscode / Gallery / git-mod

git-mod

A /git side panel: changed files with stage buttons, AI commit messages, push, and stashes with AI titles

Code you can checkTerminal + desktopPaneToastBoxButtonText

What it does

  • Draws a pane, toasts
  • Adds /git
  • Watches tool calls
  • Hooks session.start, turn.complete, ui.close
  • Starts processes

Good points

  • No network calls
  • Handles errors
  • 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 git-mod by djmid (pane, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/netgfx-git-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: "Git" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text, Button } = $.ui.resolve(e)
    return (
      <Box flexDirection="column">
        <Text color="yellow">
          No repository.
        </Text>
        <Text dimColor wrap="wrap">
          Start Claude Code inside a git repository, then press r.
        </Text>
        <Button label="Refresh (r)" hotkey="r" />
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    const hash = '…'
    await $.ui.toast(`git-mod is busy: `)
    await $.ui.toast(`Copied ${hash}`)
    return next(e)
  })
}

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.js lines 541–700 · Pane
  on('ui.render', { component: 'Pane' }, async ($, e, next) => {
    if (e.requestId !== PANE) return next(e)
    paneOpen = true
    const { Box, Text, Button, Input } = $.ui.resolve(e)
    const cols = e.props.bodyColumns ?? 60
    const narrow = cols < 44
    const redraw = () => $.ui.invalidate('ui.render')
    const rule = () => Text({ dimColor: true, children: ['─'.repeat(Math.max(10, Math.min(cols, 200)))] })

    if (!loaded) {
      refresh($).catch(() => {})
      return Box({ flexDirection: 'column', children: [Text({ dimColor: true, children: ['Reading repository…'] })] })
    }

    if (!repo || repo.error) {
      return Box({
        flexDirection: 'column',
        children: [
          Text({ color: 'yellow', children: [repo?.error ?? 'No repository.'] }),
          Text({ dimColor: true, wrap: 'wrap', children: ['Start Claude Code inside a git repository, then press r.'] }),
          Button({ key: 'refresh', label: 'Refresh (r)', hotkey: 'r', onPress: () => runAction($, 'Refreshing', async () => {}) }),
        ],
      })
    }

    const out = []

    // --- branch header ---
    const branchName = repo.isDetached ? 'detached at ' + repo.oid.slice(0, 7) : repo.branch
    out.push(
      Box({
        flexDirection: 'row',
        columnGap: 1,
        children: [
          Text({ color: 'cyan', children: ['●'] }),
          Text({ bold: true, color: 'cyan', wrap: 'truncate-middle', children: [branchName] }),
        ],
      }),
    )
    const slash = repo.branch.lastIndexOf('/')
    if (slash > 0 && !repo.isDetached) {
      const group = repo.branch.slice(0, slash)
      out.push(
        Box({
          flexDirection: 'row',
          columnGap: 1,
          paddingLeft: 2,
          children: [
            Text({ color: 'black', backgroundColor: 'blue', children: [' ' + group + ' '] }),
            Text({ dimColor: true, children: ['↳ from'] }),
            Text({ color: 'blue', bold: true, wrap: 'truncate-middle', children: [parentOf.parent || 'unknown base'] }),
          ],
        }),
      )
    }
    if (!repo.isDetached) {
      const sync = repo.upstream
        ? [
            Text({ color: repo.ahead ? 'green' : undefined, dimColor: !repo.ahead, children: ['↑' + repo.ahead] }),
            Text({ color: repo.behind ? 'red' : undefined, dimColor: !repo.behind, children: ['↓' + repo.behind] }),
            Text({ dimColor: true, wrap: 'truncate-middle', children: [repo.upstream] }),
          ]
        : [Text({ color: 'yellow', dimColor: true, wrap: 'truncate-end', children: [repo.isUnborn ? 'no commits yet' : 'not pushed yet · push sets upstream'] })]
      out.push(Box({ flexDirection: 'row', columnGap: 1, paddingLeft: 2, children: sync }))
    }

    // --- action bar ---
    const staged = stagedFiles()
    const unstaged = unstagedFiles()
    out.push(
      Box({
        flexDirection: 'row',
        flexWrap: 'wrap',
        columnGap: 1,
        marginTop: 1,
        children: [
          Button({
            key: 'stash',
            label: 'Stash (s)',
            hotkey: 's',
            dimColor: !files.length,
            onPress: () => runAction($, 'Stashing (writing a title)', () => stash($)),
          }),
          Button({
            key: 'commit',
            label: 'Commit (c)',
            hotkey: 'c',
            dimColor: !staged.length,
            ...(staged.length && !draft ? { variant: 'primary' } : {}),
            onPress: () => {
              if (!staged.length) return setNotice($, 'info', 'Nothing is staged. Press Stage on the files to commit.')
              if (draft) return setNotice($, 'info', 'A message is already drafted below. Approve, edit or cancel it.')
              return runAction($, 'Writing commit message', () => generateCommitMessage($))
            },
          }),
          Button({
            key: 'pull',
            label: 'Pull (l)' + (repo.behind ? ' ↓' + repo.behind : ''),
            hotkey: 'l',
            dimColor: !repo.upstream,
            ...(repo.behind && !staged.length && !draft ? { variant: 'primary' } : {}),
            onPress: () => runAction($, 'Pulling', () => pull($)),
          }),
          Button({
            key: 'push',
            label: 'Push (p)' + (repo.ahead ? ' ↑' + repo.ahead : ''),
            hotkey: 'p',
            ...(repo.ahead && !repo.behind && !staged.length && !draft ? { variant: 'primary' } : {}),
            onPress: () => runAction($, 'Pushing', () => push($)),
          }),
          Button({ key: 'refresh', label: 'r', hotkey: 'r', plain: true, dimColor: true, onPress: () => runAction($, 'Refreshing', async () => {}) }),
        ],
      }),
    )

    if (busy) out.push(Text({ color: 'yellow', children: ['… ' + busy] }))

    // --- notice banner ---
    if (notice) {
      const color = notice.tone === 'ok' ? 'green' : notice.tone === 'error' ? 'red' : 'blue'
      const mark = notice.tone === 'ok' ? '✓ ' : notice.tone === 'error' ? '✕ ' : '● '
      out.push(
        Box({
          flexDirection: 'column',
          borderStyle: 'round',
          borderColor: color,
          paddingX: 1,
          marginTop: 1,
          children: [
            Text({ color, wrap: 'wrap', children: [mark + notice.text] }),
            Box({
              flexDirection: 'row',
              columnGap: 1,
              children: [
                ...(notice.hash
                  ? [Button({ key: 'copy-hash', label: 'Copy hash', plain: true, onPress: (p) => { $.ui.copy({ text: notice.hash, surface: p.surface }); $.ui.toast('Copied ' + notice.hash.slice(0, 10)) } })]
                  : []),
                Button({ key: 'dismiss', label: 'Dismiss', plain: true, dimColor: true, onPress: () => { notice = null; redraw() } }),
              ],
            }),
          ],
        }),
      )
    }

    // --- commit draft ---
    if (draft) {
      const d = draft
      const body = d.isEditing
        ? [
            Input({
              key: 'edit-subject',
              label: 'Subject ',
              value: d.subject,
              placeholder: 'Short imperative summary',
              submitLabel: 'save',
              autoFocus: true,
              onInput: (v) => { d.subject = v },
              onSubmit: (v) => { d.subject = v; redraw() },
            }),
Licence text (MIT)
MIT License

Copyright (c) 2026 Michael Dobekidis

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 programsdrives 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 36bfb2876b62 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.hooks/register.js
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.reaches the network, but reads no files and no environment variables
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 netgfx/claude-git-mod
/plugin install git-mod@claude-git-mod

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

Search them from Claude: the MCP connector

Similar designs