Files
GitLite/src/lib/types.ts
T
Christoph Brandau e503786211 feat(analytics): add optional Aptabase event tracking UI
Integrate Aptabase analytics via a Tauri plugin and add a privacy
notice flow plus a settings dialog to control whether anonymous
usage events are sent. The app now tracks key user actions while
ensuring analytics never blocks core Git operations.

- Add analytics tracking helper and Aptabase plugin wiring
- Persist analytics consent in localStorage and gate tracking
- Introduce notice and settings dialogs, plus new event calls
2026-07-07 17:35:20 +02:00

205 lines
4.1 KiB
TypeScript

export type FileStatusKind =
| "modified"
| "added"
| "deleted"
| "renamed"
| "untracked"
| "conflicted"
| "unknown";
export type CommitAiPhase = "idle" | "loading" | "ready" | "error";
export type CommitAiProvider = "local" | "openai" | "anthropic" | "custom";
export type CommitAiLocalProfile = "fast" | "balanced" | "detailed";
export interface CommitAiStatus {
phase: CommitAiPhase;
model_id: string | null;
error: string | null;
}
export interface LocalModelOption {
id: string;
label: string;
approx_size_mb: number;
}
export interface AiSettings {
provider: CommitAiProvider;
localModelId: string;
localProfile: CommitAiLocalProfile;
openaiModel: string;
anthropicModel: string;
customBaseUrl: string;
customModel: string;
}
export interface AnalyticsSettings {
enabled: boolean;
noticeSeen: boolean;
}
export interface GitStatus {
repo_path: string;
current_branch: string | null;
upstream: string | null;
ahead: number;
behind: number;
files: GitFileStatus[];
clean: boolean;
rebase_in_progress: boolean;
cherry_pick_in_progress: boolean;
}
export interface GitFileStatus {
path: string;
old_path: string | null;
staged: FileStatusKind | null;
unstaged: FileStatusKind | null;
}
export type PatchApplyAction = "stage" | "unstage" | "discard-unstaged" | "discard-staged";
export interface GitBranch {
name: string;
current: boolean;
remote: boolean;
}
export interface GitTag {
name: string;
hash: string;
short_hash: string;
message: string | null;
date: string;
annotated: boolean;
}
export interface GitStash {
selector: string;
index: number;
hash: string;
branch: string | null;
message: string;
date: string;
}
export interface GitCommit {
hash: string;
short_hash: string;
summary: string;
author_name: string;
author_email: string;
date: string;
refs: string[];
parents: string[];
files: GitCommitFile[];
}
export interface GitCommitFile {
path: string;
old_path: string | null;
status: FileStatusKind;
}
export interface GitRepositoryFile {
path: string;
tracked: boolean;
status: FileStatusKind | null;
}
export interface RepositoryBundle {
status: GitStatus;
branches: GitBranch[];
tags: GitTag[];
stashes: GitStash[];
commits: GitCommit[];
files: GitRepositoryFile[];
}
export interface GitDiffFile {
path: string;
old_path: string | null;
status: FileStatusKind;
additions: number;
deletions: number;
}
export interface GitCommitComparison {
from_hash: string;
from_short: string;
to_hash: string;
to_short: string;
files: GitDiffFile[];
patch: string;
}
export interface GitSearchHit {
commit_hash: string;
short_hash: string;
summary: string;
author_name: string;
author_email: string;
date: string;
file: string;
old_file: string | null;
line_number: number | null;
line: string;
matches_added: number;
}
export type ExplorerNodeKind = "folder" | "file";
export interface ExplorerNode {
name: string;
path: string;
kind: ExplorerNodeKind;
status: FileStatusKind | null;
tracked: boolean;
depth: number;
children: ExplorerNode[];
}
export type ConflictChoice = "ours" | "theirs" | "both-ot" | "both-to";
export type ConflictPart =
| { kind: "text"; lines: string[] }
| { kind: "conflict"; index: number; oursLines: string[]; theirsLines: string[] };
export type PreparedResolution =
| { kind: "content"; content: string }
| { kind: "side"; side: "ours" | "theirs" };
export interface ConflictFile {
path: string;
content: string;
ours: string | null;
theirs: string | null;
base: string | null;
binary: boolean;
ours_size: number | null;
theirs_size: number | null;
}
export interface GitBlameLine {
line_number: number;
content: string;
commit_hash: string;
short_hash: string;
author_name: string;
author_email: string;
author_time: number;
summary: string;
is_uncommitted: boolean;
}
export interface GitBlameResult {
path: string;
lines: GitBlameLine[];
}
export interface StoredCredential {
username: string;
password: string;
expiresAt?: string | null;
}