char-slop/berry

multipurpose self-modifiable agentic harness

git clone https://git.t4t.associates/char-slop/berry

Charlotte Somshow full IDs in diff summaries and simplify Git ID styling9b84ad5

main
1.5 KiB44 linesraw
1// What the server sends the view.
2
3import type { FileDiff } from "./patch.ts";
4
5export type { FileDiff, Hunk } from "./patch.ts";
6
7/** An id as jj shows it: the shortest unique prefix, then a few more characters. */
8export type Id = { full: string; prefix: string; rest: string };
9
10/** A commit, or jj's change, in the log. */
11export type Revision = {
12  /** What the view's route names it by: jj's change id or git's commit hash, or `""` for the working copy. */
13  route: string;
14  /** jj's change id. */
15  change: Id | null;
16  /** `null` for git's working tree, which is not one yet. */
17  commit: Id | null;
18  description: string;
19  author: { name: string; email: string; timestamp: string } | null;
20  /** Bookmarks, branches and tags at it. */
21  refs: string[];
22  workingCopy: boolean;
23  empty: boolean;
24  immutable: boolean;
25  conflict: boolean;
26};
27
28/** A file's change as it is sent: left out, but for its key, when the view has it already. */
29export type Sent = { key: string; diff: FileDiff | null };
30
31/** A repository's recent history, and one revision's changes. */
32export type Shown = {
33  vcs: "jj" | "git";
34  root: string;
35  /** From the working copy back. */
36  log: Revision[];
37  revision: Revision;
38  files: FileDiff[];
39  /** Untracked files in git's working tree past those shown. */
40  omitted: number;
41};
42
43/** What the view is sent: what it shows, but each file's change only if it did not have that already. */
44export type Reply = Omit<Shown, "files"> & { files: Sent[] };