Official

git

Built-in git UI (JavaScript UI plugin).

The app opens the listing; nothing installs until an agent in your Plugins workspace has read the files and you enable the plugin. In a terminal: dvg install divergence/git@0.3.1

Permissions in 0.3.1

  • Run git commands git.writeHighRuns any git command.Stage, commit, switch branches and sync with the remote
  • Use your agents' models models.useHighRuns prompts through the agents you enabled.Write commit messages and pull requests with the cheapest model of your agents, on your own account
  • Read chats chats.readMediumReads your transcripts and chat lists.Refresh when an agent finishes a turn
  • Run named programs processMediumStarts the listed programs.Find and open the branch's pull request with the GitHub CLIPrograms: gh
  • Read git status and diffs git.readLowReads git status and diffs.Show the repository's status and diffs, and follow its changes
  • Show panels ui.slotsAlways grantedShows views in the listed parts of the window.Show the source control button and panelSlots: railright

Files

views/panel.tsx5.2 KB
// Source-control rail and panel; rendering never starts a host request.
// HTM whitespace is significant; keep these templates out of Prettier's HTML formatter.
import type { Element } from "divergence";
import type { EffectViewContext } from "divergence/effect";
import type { Git } from "../controller.ts";
import { groups, isOpen } from "../status.ts";
import { controls } from "./controls.tsx";
import { entriesView } from "./entries.tsx";
import { column, row, fill, full, INSET } from "./layout.ts";
import { pullRequest } from "./pull.tsx";

export function renderRail(ctx: EffectViewContext<object>, actions: Git["Service"]) {
  const { state } = actions;
  const count = state.status?.entries?.length ?? 0;
  const pinned = ctx.app.shared?.rightPanel === "git";
  // Drawn a little larger than the button's usual icon (about 13.3px): the glyph is narrower than the
  // reload button's round one above it, and at 15.2px it is as wide.
  return <button id="rail-git" icon="git-branch" iconSize={15.2} variant="ghost" active={pinned} badge={count ? String(count) : undefined} tooltip={count ? `Source Control · ${count} changed` : "Source Control"} onClick={() => ctx.run(actions.toggle)} />;
}

// The sections that have files, with a line between two of them so each
// group's end is plain.
function divided(sections: readonly (Element | null)[]) {
  return sections.filter((s) => s !== null).map((s, i) => [i ? <divider /> : null, s]);
}

export function renderPanel(ctx: EffectViewContext<object>, actions: Git["Service"]) {
  const { state } = actions;
  const { messageField, primaryButton, branchPicker, menu } = controls(ctx, actions);
  const { action, section, confirmed } = entriesView(ctx, actions);
  if (!isOpen(ctx.app)) return null;
  const workspaceId = ctx.app.workspaceId;
  if (!workspaceId)
    return <div {...column} gap="small" padding="medium"><text style="muted">Select a workspace to see its changes.</text></div>;
  const status = state.status;
  const g = status?.isRepo ? groups(status) : { merge: [], staged: [], changes: [] };
  const total = g.merge.length + g.staged.length + g.changes.length;
  // A rail button's height at the panel's top: the header's buttons sit
  // on the line of the rail's first icon.
  const header = (
    <div {...row} gap="small" paddingX="small" height="2rem">
      <div {...row} {...fill} gap="small" padding="small" paddingX={INSET}><text style="body" size={13.125} weight={600} truncate>Source Control</text></div>
      {state.busy ? <div {...row} gap="small" padding="small"><spinner /><text style="body" size="xs" tone="muted">{state.busy}</text></div> : null}
      {status?.isRepo
                  ? <button id="git-header-commit" icon="check" variant="ghost" small tooltip="Commit" disabled={!!state.busy || !total || (state.writing && !state.message.trim())} onClick={() => ctx.run(actions.commit())} />
                  : null}
      <button id="git-refresh" icon="rotate-cw" variant="ghost" small tooltip="Refresh" onClick={() => ctx.run(actions.reload)} />
      {status?.isRepo ? menu(status, g) : null}
      <button id="git-close" icon="x" variant="ghost" small tooltip="Close" onClick={() => ctx.run(actions.close)} />
    </div>
  );
  const body = (...children: (Element | null)[]) =>
    <div {...column} {...fill} {...full} gap="small" padding="small" paddingTop={0}>{header}{children}</div>;
  if (state.error) return body(<text style="body" size="xs" tone="danger">{state.error}</text>);
  if (!status) return body(<text style="muted">Loading…</text>);
  if (!status.isRepo) return body(<text style="muted">This workspace is not in a git repository.</text>);

  return body(
    (
      // The branch row's icon starts where the box's text does, and the box and buttons span one width.
      <div {...column} gap="medium" padding="small">
        {branchPicker(status)}
        {messageField(status)}
        {primaryButton(status, total)}
        {pullRequest(ctx, actions, status)}
      </div>
    ),
    (
      <div {...column} {...fill} gap="small" padding="small" paddingY="small" overflowY="scroll">
        {divided([section("merge", "Merge Changes", g.merge, [
                    action("git-merge-stage-all", "plus", "Stage All Merge Changes", () => ctx.run(actions.stage(g.merge))),
                  ]),
                  section("staged", "Staged Changes", g.staged, [
                    action("git-staged-unstage-all", "minus", "Unstage All Changes", () => ctx.run(actions.unstage(g.staged))),
                  ]),
                  section("changes", "Changes", g.changes, [
                    action(
                      "git-changes-discard-all",
                      "undo-2",
                      state.confirm === "discard:all" ? "Click again to discard all changes" : "Discard All Changes",
                      () => confirmed("discard:all", actions.discard(g.changes)),
                      state.confirm === "discard:all",
                    ),
                    action("git-changes-stage-all", "plus", "Stage All Changes", () => ctx.run(actions.stage(g.changes))),
                  ])])}
        {total ? null : <div {...column} gap="small" padding="small" paddingX={INSET} paddingY="medium"><text style="muted">No changes. The working tree is clean.</text></div>}
      </div>
    ),
  );
}

Versions

VersionPublishedPlugin APISizePermissionsStatus
0.3.3latestNov 21, 2026>=5 <630.8 KB6 permissionsListed
0.3.2Nov 16, 2026>=5 <630.4 KB6 permissionsListed
0.3.1Nov 11, 2026>=5 <630.2 KB6 permissionsListed
0.3.0Nov 9, 2026>=5 <629.2 KB6 permissionsListed
0.2.1Oct 27, 2026>=2 <413.6 KB4 permissionsListed

Reviews and comments

0 threads · 0 reviews

No comments yet.