a very good jj gui
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

use Effect Schema for Tauri commands

+75 -49
+65
apps/desktop/src/schemas.ts
··· 1 + import { Schema } from "effect"; 2 + 3 + export const Revision = Schema.Struct({ 4 + commit_id: Schema.String, 5 + change_id: Schema.String, 6 + change_id_short: Schema.String, 7 + parent_ids: Schema.Array(Schema.String), 8 + description: Schema.String, 9 + author: Schema.String, 10 + timestamp: Schema.String, 11 + is_working_copy: Schema.Boolean, 12 + is_immutable: Schema.Boolean, 13 + bookmarks: Schema.Array(Schema.String), 14 + }); 15 + export type Revision = typeof Revision.Type; 16 + 17 + export const ChangedFileStatus = Schema.Literal("added", "modified", "deleted"); 18 + export type ChangedFileStatus = typeof ChangedFileStatus.Type; 19 + 20 + export const ChangedFile = Schema.Struct({ 21 + path: Schema.String, 22 + status: ChangedFileStatus, 23 + }); 24 + export type ChangedFile = typeof ChangedFile.Type; 25 + 26 + export const WorkingCopyStatus = Schema.Struct({ 27 + repo_path: Schema.String, 28 + change_id: Schema.String, 29 + files: Schema.Array(ChangedFile), 30 + }); 31 + export type WorkingCopyStatus = typeof WorkingCopyStatus.Type; 32 + 33 + export const DiffLineType = Schema.Literal("context", "add", "remove"); 34 + export type DiffLineType = typeof DiffLineType.Type; 35 + 36 + export const DiffLine = Schema.Struct({ 37 + line_type: DiffLineType, 38 + content: Schema.String, 39 + old_line_number: Schema.NullOr(Schema.Number), 40 + new_line_number: Schema.NullOr(Schema.Number), 41 + }); 42 + export type DiffLine = typeof DiffLine.Type; 43 + 44 + export const DiffHunk = Schema.Struct({ 45 + old_start: Schema.Number, 46 + old_count: Schema.Number, 47 + new_start: Schema.Number, 48 + new_count: Schema.Number, 49 + lines: Schema.Array(DiffLine), 50 + }); 51 + export type DiffHunk = typeof DiffHunk.Type; 52 + 53 + export const FileDiff = Schema.Struct({ 54 + path: Schema.String, 55 + hunks: Schema.Array(DiffHunk), 56 + }); 57 + export type FileDiff = typeof FileDiff.Type; 58 + 59 + export const Project = Schema.Struct({ 60 + id: Schema.String, 61 + path: Schema.String, 62 + name: Schema.String, 63 + last_opened_at: Schema.Number, 64 + }); 65 + export type Project = typeof Project.Type;
+10 -49
apps/desktop/src/tauri-commands.ts
··· 1 1 import { invoke } from "@tauri-apps/api/core"; 2 2 3 - export interface Revision { 4 - commit_id: string; 5 - change_id: string; 6 - change_id_short: string; 7 - parent_ids: string[]; 8 - description: string; 9 - author: string; 10 - timestamp: string; 11 - is_working_copy: boolean; 12 - is_immutable: boolean; 13 - bookmarks: string[]; 14 - } 15 - 16 - export interface ChangedFile { 17 - path: string; 18 - status: "added" | "modified" | "deleted"; 19 - } 3 + export type { 4 + Revision, 5 + ChangedFile, 6 + WorkingCopyStatus, 7 + DiffLine, 8 + DiffHunk, 9 + FileDiff, 10 + Project, 11 + } from "./schemas"; 20 12 21 - export interface WorkingCopyStatus { 22 - repo_path: string; 23 - change_id: string; 24 - files: ChangedFile[]; 25 - } 26 - 27 - export interface DiffLine { 28 - line_type: "context" | "add" | "remove"; 29 - content: string; 30 - old_line_number: number | null; 31 - new_line_number: number | null; 32 - } 33 - 34 - export interface DiffHunk { 35 - old_start: number; 36 - old_count: number; 37 - new_start: number; 38 - new_count: number; 39 - lines: DiffLine[]; 40 - } 41 - 42 - export interface FileDiff { 43 - path: string; 44 - hunks: DiffHunk[]; 45 - } 46 - 47 - export interface Project { 48 - id: string; 49 - path: string; 50 - name: string; 51 - last_opened_at: number; 52 - } 13 + import type { FileDiff, Project, Revision, WorkingCopyStatus } from "./schemas"; 53 14 54 15 export async function findRepository(startPath: string): Promise<string | null> { 55 16 return invoke<string | null>("find_repository", { startPath });