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

writer.ts3.5 KB
// Text an agent writes for the panel: a commit message from the changes, a pull request from the branch's commits.
// It runs one prompt through the cheapest model of the user's enabled agents (`api.models`, `models.use`), in a hidden
// session in the workspace that the user's own account pays for; interrupting it cancels the run.
import * as Data from "effect/Data";
import * as Effect from "effect/Effect";
import { Host, Plugin, promise } from "divergence/effect";
import type { GitStatus } from "divergence";
import { cleanMessage, commitPrompt, pullPrompt, splitPull, writerModel } from "./prompts.ts";
import { groups } from "./status.ts";
import type { PullTarget } from "./status.ts";

/** A step that did not work, in git's, gh's or the agent's own words. */
export class ActionFailed extends Data.TaggedError("ActionFailed")<{ readonly message: string }> {}

export const makeWriter = Effect.fn("Git.makeWriter")(function* () {
  const host = yield* Host;
  const { api } = yield* Plugin;
  /** git's output, or its error output as the failure. */
  const read = Effect.fn("Git.read")(function* (workspaceId: string, args: readonly string[]) {
    const result = yield* host.call("host/git.run", { workspaceId, args });
    if (result.code !== 0)
      return yield* new ActionFailed({ message: (result.stderr || result.stdout).trim() || `git ${args[0]} failed` });
    return result.stdout;
  });
  const ask = Effect.fn("Git.ask")(function* (workspaceId: string, prompt: string) {
    const { agents } = yield* promise("models.list", () => api.models.list({ workspaceId }));
    const choice = writerModel(agents);
    if (!choice) return yield* new ActionFailed({ message: "no agent is enabled; turn one on in Settings" });
    const answer = yield* promise("models.prompt", (signal) =>
      api.models.prompt({ ...choice, prompt, workspaceId, signal }),
    );
    if (answer.status !== "completed")
      return yield* new ActionFailed({ message: answer.message ?? "the agent stopped before it answered" });
    return answer.text;
  });
  /** A message for what a commit would take now: the staged changes, or every change when nothing is staged. */
  const commitMessage = Effect.fn("Git.writeCommitMessage")(function* (workspaceId: string, status: GitStatus) {
    const { staged, changes } = groups(status);
    const files = staged.length ? staged : changes;
    const diff = yield* read(
      workspaceId,
      staged.length ? ["diff", "--cached", "--no-color", "-M"] : ["diff", "--no-color", "-M"],
    );
    const message = cleanMessage(yield* ask(workspaceId, commitPrompt({ branch: status.branch, files, diff })));
    if (!message) return yield* new ActionFailed({ message: "the agent answered with no message" });
    return message;
  });
  /** A title and description from the commits the branch has over the default branch; `null` when it has none. */
  const pullRequest = Effect.fn("Git.writePullRequest")(function* (workspaceId: string, target: PullTarget) {
    const base = `${target.remote}/${target.base}`;
    const commits = yield* read(workspaceId, ["log", "--no-merges", "--format=* %s%n%n%b", `${base}..HEAD`]);
    if (!commits.trim()) return null;
    const stat = yield* read(workspaceId, ["diff", "--stat", "--no-color", `${base}...HEAD`]);
    const pull = splitPull(
      yield* ask(workspaceId, pullPrompt({ head: target.head, base: target.base, commits, stat })),
    );
    if (!pull.title) return yield* new ActionFailed({ message: "the agent answered with no title" });
    return pull;
  });
  return { read, commitMessage, pullRequest };
});

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.