my-durable 0.0.23 → 0.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -167,6 +167,7 @@ export async function gitStatus(path: string): Promise<GitStatus> {
167
167
  export type GitOp =
168
168
  | "diff"
169
169
  | "log"
170
+ | "log-list"
170
171
  | "fetch"
171
172
  | "pull"
172
173
  | "switch"
@@ -184,13 +185,30 @@ export async function gitOp(
184
185
  path: string,
185
186
  op: GitOp,
186
187
  opts: { ref?: string; message?: string; target?: string; branch?: string; files?: string[] } = {},
187
- ): Promise<{ text: string }> {
188
+ ): Promise<{ text: string; commits?: { hash: string; refs: string; author: string; date: string; subject: string }[] }> {
188
189
  const { ref, message, target, branch, files } = opts;
189
190
  switch (op) {
190
191
  case "diff":
191
192
  return { text: await git(path, ["--no-pager", "diff", ...(ref && safeRef(ref) ? [ref] : [])]) };
192
193
  case "log":
193
194
  return { text: (await git(path, ["--no-pager", "log", "--oneline", "-n", "30", ...(ref && safeRef(ref) ? [ref] : [])])).trimEnd() };
195
+ case "log-list": {
196
+ // IntelliJ's log window: hash, refs, author, date, subject — structured.
197
+ const raw = await git(
198
+ path,
199
+ ["--no-pager", "log", "-n", "50", "--date=short", "--pretty=format:%h%x1f%D%x1f%an%x1f%ad%x1f%s"],
200
+ );
201
+ return {
202
+ text: "",
203
+ commits: raw
204
+ .split("\n")
205
+ .filter(Boolean)
206
+ .map((l) => {
207
+ const [hash, refs, author, date, subject] = l.split("\x1f");
208
+ return { hash: hash ?? "", refs: refs ?? "", author: author ?? "", date: date ?? "", subject: subject ?? "" };
209
+ }),
210
+ };
211
+ }
194
212
  case "fetch":
195
213
  return { text: (await git(path, ["fetch", "--all", "--prune"])).trim() || "fetched" };
196
214
  case "pull":
@@ -11,7 +11,7 @@ import type { DevicePairing } from "./pairing.js";
11
11
  type Async = (req: Request, res: Response) => Promise<unknown>;
12
12
  const route = (fn: Async) => (req: Request, res: Response, next: NextFunction) => fn(req, res).catch(next);
13
13
  import { gitOp, gitStatus, gitStatusBatch, type GitOp } from "./git.ts";
14
- const GIT_OPS: GitOp[] = ["diff", "log", "fetch", "pull", "switch", "branch", "commit", "worktree-list", "worktree-add", "worktree-remove"];
14
+ const GIT_OPS: GitOp[] = ["diff", "log", "log-list", "fetch", "pull", "switch", "branch", "commit", "worktree-list", "worktree-add", "worktree-remove"];
15
15
 
16
16
  interface Locals {
17
17
  row: SessionRow;