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.3
Permissions in 0.3.3
Files
views/pull.tsx2.3 KB
// The branch's pull request under the commit box: Create Pull Request, the form an agent fills in and the user edits,
// or the open pull request's link, which opens in the browser.
// HTM whitespace is significant; keep these templates out of Prettier's HTML formatter.
import type { GitStatus } from "divergence";
import type { EffectViewContext } from "divergence/effect";
import type { Git } from "../controller.ts";
import { column, fill, panelRow, row } from "./layout.ts";
export function pullRequest(ctx: EffectViewContext<object>, actions: Git["Service"], status: GitStatus) {
const { state } = actions;
const pull = state.pull;
switch (pull.kind) {
case "none":
return null;
case "failed":
return <text style="body" size="xs" tone="danger">{pull.message}</text>;
case "offer":
return <button id="git-pr-create" icon="git-pull-request" label="Create Pull Request" disabled={!!state.busy} onClick={() => ctx.run(actions.createPull())} />;
case "link":
return (
<div {...panelRow} cursor="pointer" id="git-pr-link" onClick={() => ctx.run(actions.openPullLink)}>
<icon name="git-pull-request" small tone="muted" />
<text style="body" size="xs" tone="muted" truncate>{`Pull request #${pull.number}`}</text>
</div>
);
case "draft":
return (
<div {...column} gap="small">
<input id="git-pr-title" value={pull.title} placeholder={pull.writing ? "Writing the title…" : "Title"} onChange={(e: { value: string }) => {
ctx.run(actions.editPull("title", e.value));
ctx.update();
}} />
<input id="git-pr-body" multiline value={pull.body} placeholder={pull.writing ? "Writing the description…" : "Description"} onChange={(e: { value: string }) => {
ctx.run(actions.editPull("body", e.value));
ctx.update();
}} />
<div {...row} gap="small">
<div {...column} {...fill}><button id="git-pr-open" icon="git-pull-request" label="Open Pull Request" disabled={!!state.busy || !pull.title.trim()} onClick={() => ctx.run(actions.openPull(status))} /></div>
<button id="git-pr-cancel" label="Cancel" variant="ghost" disabled={!!state.busy} onClick={() => ctx.run(actions.cancelPull)} />
</div>
</div>
);
}
}
No comments yet.