Compare commits

...
24 Commits
Author SHA1 Message Date
Christoph 8bec7dfc9a style(ui): refine tab and dialog close button visuals
publish / Build and publish Ubuntu AppImage (release) Successful in 9m31s
publish / Build and publish Windows installer (release) Successful in 10m28s
publish / Build and publish AUR packages (release) Successful in 19m9s
Adjust spacing and sizing for repo tabs and close controls. Add
transitions, larger hit areas, and updated hover/focus styles. Introduce
theme-aware variants and neutral dialog close styling for consistency.
Also update help overlay close to match the new behavior.

- increase close button size and tweak padding for alignment
- add transitions and inset focus/hover visuals with themes
- normalize dialog and help close appearance for consistency
2026-08-31 11:14:56 +02:00
Christoph 7950edb145 fix(clone-dialog): improve layout and scrolling
Adjust grid templates and overflow rules to improve layout.
Replace fixed heights with flexible rows so content fills space.
Hide overflow and tweak alignment to avoid double scrollbars.

- Use grid-template-rows to allocate header, controls, and list area
- Make repository list shell and list use height: 100% and overflow:auto
- Align URL field to the top to prevent unexpected scrolling
2026-08-31 10:25:07 +02:00
Christoph e3af6653cd fix(layout): account for repo tab bar in loading overlay
Adjust the fixed loading overlay to avoid overlapping the repo tab bar.
The top offset now adds the app titlebar and repo tabbar heights using
CSS calc with reasonable fallbacks. This keeps the overlay aligned with
top UI elements when a repository tab bar is present.

- Offset top by titlebar plus repo tabbar heights via CSS calc.
- Provide sensible fallback values to maintain stable layout.
2026-08-31 10:10:00 +02:00
Christoph b752c0804b style(repo-loading-overlay): adjust overlay position and backdrop
Remove the extra vertical offset so the loading overlay aligns with the
app titlebar. Update the backdrop color mix and increase blur to improve
contrast and perceived depth while the overlay is visible.

- Align overlay using the titlebar height variable instead of adding a
  fixed offset
- Use a denser color mix and stronger blur for a clearer backdrop effect
2026-08-31 09:05:10 +02:00
Christoph 8f98e79df9 feat(clone-dialog): redesign UI and group Azure DevOps repos
Rework CloneRepositoryDialog into a two-column layout with a source
sidebar and focused content area to make browsing sources easier.
Group Azure DevOps repositories by project with a new derived value
and render sticky project headers for clearer navigation.
Replace showIntegrations with selectIntegrationSource to load the
chosen integration, refresh repositories, and update labels and styles.

- Introduce source sidebar and refreshed dialog layout
- Add azureRepositoryGroups and project grouping UI
- Rename flow to selectIntegrationSource and improve loading logic
2026-08-31 08:43:00 +02:00
Christoph f0a1d89152 Update version to 2026.8.9 2026-08-30 20:26:46 +02:00
Christoph c3762ae7a3 feat(git): add opt-in for unrelated histories during pull
publish / Build and publish Windows installer (release) Successful in 10m2s
publish / Build and publish Ubuntu AppImage (release) Successful in 10m28s
publish / Build and publish AUR packages (release) Successful in 22m1s
Allow pulling repositories with unrelated commit histories when the user
explicitly opts in. The pull argument construction was refactored and
branch resolution made more robust so the backend can include the
--allow-unrelated-histories flag when requested.

- Extract pull argument logic and add support for allowing unrelated histories.
- Prompt users in the UI to confirm merging separate histories and retry pull.
- Restyle and improve the update toast UI for better layout and responsiveness.
2026-08-30 20:25:15 +02:00
Christoph 4db6f30461 refactor(commit-ai): remove local models and simplify AI flow
Remove local on-device model support and related IPC commands,
consolidating commit-generation to cloud providers and simplifying the
AI crate surface. Local-specific types, generation profiles, caching,
and the local prompt builder were removed while message sanitization and
diff-echo detection were preserved. Also harden repository handling and
runtime: unborn HEADs are handled gracefully so empty repos still report
files, Git LFS sync is skipped for repositories without commits, and
tokio runtime features were enabled.

- Remove local model engine, load/status commands, and local profile code
- Handle unborn HEAD and skip LFS sync for repos without commits
- Enable tokio runtime features and route AI generation to cloud only
2026-08-30 19:16:32 +02:00
Christoph 9c93d5a978 feat(integrations): add Git hosting providers and Clone UI
publish / Build and publish Ubuntu AppImage (release) Successful in 24m41s
publish / Build and publish Windows installer (release) Successful in 26m36s
publish / Build and publish AUR packages (release) Successful in 54m9s
Add integrations for GitHub, GitLab (cloud & self-hosted), Azure DevOps,
and Gitea, storing personal access tokens in the operating system
keychain. Azure DevOps supports multiple independently configurable
organizations, and the Clone → Integrations tab loads, filters, sorts,
and clones repositories using stored credentials. Update the API
contract, help overlay, README, changelog, and application version
metadata to document and ship the feature.

- Add list_integration_repositories API command and related types
- New Clone → Integrations UI with search, refresh, and direct clone
- Store tokens in OS keychain and support multiple Azure DevOps orgs
2026-08-30 00:05:01 +02:00
Christoph c242a72edd feat(integrations): support GitHub repositories and enhance repo browser UI
Add GitHub repository support to integrations and update related tests.
Implement server-side GitHub API calls and normalize GitHub base URLs.
Improve the repository browser UI with compact tabs and updated icons.
Add a custom, accessible scrollbar with pointer and keyboard support.

- Add paging, auth headers, and error handling when listing GitHub repos.
- Default GitHub token username to "x-access-token" when saving credentials.
- Introduce compact repo tab styles, new icons, and a draggable scrollbar.
2026-08-29 23:55:27 +02:00
Christoph 91263547db feat(integrations): add Git hosting integrations and repo listing
Add support for integrating with external Git hosts (GitLab, Gitea,
and Azure DevOps). The backend gains a client to fetch paginated
repository lists, normalise base URLs, and surface provider errors.
Credentials are loaded from the OS keychain and a Tauri command is
exposed for the frontend to list integration repositories.

- Implement integration client with pagination, deserialization,
  and provider-specific handling.
- Centralise keychain credential loading and expose listing command.
- Update UI to manage integration metadata, persist settings, and
  save/remove tokens to the OS keychain for cloning and operations.
2026-08-29 23:25:51 +02:00
Christoph 823a50ce85 style(repo-loading): refine overlay visuals and theming
Update the repository loading overlay and related UI styles to use
design tokens, improve contrast, and reduce visual bulk. Sizes,
spacing, radii, and icon dimensions were tuned to create a more
compact, consistent card. Backgrounds, grid textures, and shadows
were switched to CSS variables and color-mix; subtle backdrop-filter
and opacity tweaks improve legibility across themes.

- Replace hardcoded colors with theme variables and color-mix
- Reduce component dimensions and tighten spacing for a compact UI
- Add backdrop blur, adjust grid opacity, and simplify shadows
2026-08-29 22:52:14 +02:00
Christoph 22da397e39 fix(git): make unsetting upstream idempotent
Saving sync settings with no upstream could cause a fatal Git
error when unsetting upstream on a branch that never had tracking
information. This change guards the operation by checking for an existing
merge configuration before unsetting, making it idempotent. A test was
added to verify that clearing an unconfigured upstream is a no-op.

- Add test ensuring clearing an unconfigured upstream is a no-op
2026-08-26 00:35:30 +02:00
Christoph f160e48777 Update version to 2026.8.7 2026-08-23 23:41:30 +02:00
Christoph 4533f8aa38 style(theme): add dialog & panel CSS vars and refactor status panel styles
publish / Build and publish Ubuntu AppImage (release) Successful in 19m39s
publish / Build and publish Windows installer (release) Successful in 22m14s
publish / Build and publish AUR packages (release) Successful in 48m41s
Add CSS custom properties for dialog backdrop, shadows, and panel
highlights to centralize visual theming. Refactor the status panel
overlay to consume these tokens and use color-mix instead of hardcoded
rgba values. This improves visual consistency and lets overlays adapt
cleanly to appearance changes and theme variants.

- Centralize dialog and panel visuals with new CSS variables
- Replace fixed rgba values with tokenized colors and color-mix
- Move borders, shadows, and gradients to use the new theme tokens
2026-08-23 23:38:42 +02:00
Christoph f0bd74be4e Merge pull request 'feat(history): make branch filter groups collapsible' (#28) from new-desgin into main
publish / Build and publish Windows installer (release) Failing after 13s
publish / Build and publish AUR packages (release) Canceled after 0s
publish / Build and publish Ubuntu AppImage (release) Canceled after 54s
Reviewed-on: #28
2026-08-23 21:28:46 +00:00
Christoph 79f4ec21e4 feat(history): make branch filter groups collapsible
Add collapsible local and remote branch groups to the branch
visibility dialog, including toggle buttons and selection counts.
Introduce comprehensive dialog styling and responsive rules to match
the app UI. Opening the dialog now defaults to local open and remote
closed for faster access.

- Add CSS for branch-filter dialog layout, theming, and responsiveness
- Implement group toggles with chevrons and visible selected counts
- Default to local group open and remote group closed on dialog open
2026-08-23 23:20:13 +02:00
Christoph 44547f507a Merge pull request 'New desgin' (#27) from new-desgin into main
Reviewed-on: #27
2026-08-23 21:15:39 +00:00
Christoph 58027f5e22 feat(settings): add appearance and custom theme support
Introduce an appearance preference with modern, classic, and custom
modes and a persisted custom theme palette. Add helpers to load,
persist, and apply appearance and custom colors, and wire them into the
app settings lifecycle. Implement a comprehensive light theme and
appearance presets using CSS variables so custom palettes are applied
consistently across the UI, and include appearance in analytics when
settings are saved.

- Persist and apply appearance and custom color palette to :root
- Add muted light theme plus classic/modern presets and custom mapping
- Include appearance and customTheme in settings save and analytics payload
2026-08-23 23:14:07 +02:00
Christoph 3477070ec3 style(theme): refresh dark theme palette and control contrast
Update the dark theme tokens and UI surfaces to improve legibility
and clarify interactive boundaries across the app. Controls such as
buttons, inputs, and focus outlines were standardized and simplified
to reduce visual noise while preserving hierarchy.

- Overhaul color tokens and surface backgrounds for consistent tones
- Simplify primary button treatment and adjust focus/outline behavior
- Add targeted dark-mode rules to separate chrome (tabs, toolbars)
2026-08-23 22:20:25 +02:00
Christoph Brandau 7d3288a7ef chore(release): bump to 2026.8.6 and update changelog
publish / Build and publish Windows installer (release) Successful in 21m54s
publish / Build and publish Ubuntu AppImage (release) Successful in 20m10s
publish / Build and publish AUR packages (release) Successful in 48m1s
Bump version to 2026.8.6 across packaging, app config, and docs.
The change aligns binaries, config files, and changelog with the new release.
A new 2026.8.6 entry is added to the changelog and the UI surfaces release notes.

- Aligns version across packaging, app config, and UI
- Adds 2026.8.6 changelog entry and release notes in UI
- Prepares release by updating docs and build metadata
2026-08-18 21:43:32 +02:00
Christoph Brandau 6d806e87ea feat(git-lfs): improve activation and add HTTP/1.1 retry
The change adds a safer LFS activation flow that ensures a
root .gitattributes file is not hidden by ignore rules and
activates local LFS filters. It also merges patterns from the
repository attributes with those reported by Git LFS to avoid
duplicates and inaccuracies.

- Adds a retry path for large LFS uploads by forcing HTTP/1.1
during pushes when an HTTP 413 error is returned.
2026-08-18 21:36:13 +02:00
Christoph Brandau 7408371430 feat(startup): enable startup clone requests from CLI and IPC
Adds startup clone support with a new clone request type and parsing.
It wires a CLI and IPC pathway to forward a clone to a running app.
UI and docs were updated to reflect startup clone behavior.

- Introduce StartupCloneRequest and argument parsing.
- Wire IPC to pass clone requests and clone on startup.
- UI updated to queue clone requests and trigger clone.
2026-08-18 17:41:15 +02:00
Christoph Brandau e4697c74b6 feat(git): add ignore and untrack paths commands
The changes introduce server-side commands to manage gitignore
 rules and to untrack paths without deleting local files.
 A new GitIgnoreKind enum and helper functions normalize targets
 and build proper ignore patterns, and UI code was wired to use
 these commands.

- add_to_gitignore command and related helpers
- untrack_paths command to remove paths from the index
- UI wiring to expose ignore and untrack actions in explorer
2026-08-18 13:09:33 +02:00
34 changed files with 5138 additions and 4553 deletions
+83 -3
View File
@@ -4,6 +4,74 @@ All notable user-facing changes to Gitty are documented in this file.
The project uses calendar-style versions in the form `YYYY.M.PATCH`.
## [2026.8.8] - 2026-08-29
### Added
- Git hosting integrations for GitHub, GitLab.com, GitLab Self-Managed,
Azure DevOps, and Gitea. Personal access tokens are stored separately in
the operating system keychain.
- Azure DevOps supports multiple independently configurable organizations,
each with its own display name, organization URL, username, and token.
- The Clone dialog has an Integrations tab that loads all repositories
available to the selected account, supports filtering and refresh, sorts
repositories alphabetically, and clones the selected repository directly
with its stored credentials.
### Changed
- Repository tabs use a more compact Git-client-style bar. Close buttons
remain visible and turn red only while hovered.
- The integration repository list uses a narrow custom scrollbar that grows
only slightly on hover and no longer covers repository names or metadata.
- Repository loading and status overlays use theme-aware design tokens with
improved contrast and a more compact presentation.
### Fixed
- Clearing sync settings on a branch that never had an upstream is now a safe
no-op instead of failing with a fatal Git error.
## [2026.8.7] - 2026-08-23
### Added
- Appearance settings now offer Modern, Classic, and Custom styles. Custom
themes can define their own persisted color palette, while a complete light
theme is available alongside the refreshed dark appearance.
- The branch visibility dialog groups local and remote branches into
collapsible sections with selected-branch counts. Local branches open by
default, while the remote group starts collapsed for quicker navigation.
### Changed
- Dark-theme colors, surfaces, controls, and focus outlines have been refined
for clearer interactive boundaries and more consistent contrast throughout
the application.
- The branch visibility dialog follows the responsive layout and visual
language of the rest of Gitty more closely.
## [2026.8.6] - 2026-08-18
### Changed
- Activating LFS or adding a tracking pattern now ensures that a root
`.gitattributes` file is not hidden by Git ignore rules. When necessary,
Gitty adds the scoped `!/.gitattributes` exception to `.gitignore`.
- The standard Tauri development launcher now removes an injected non-routing
`127.0.0.1:9` proxy and blocking SSH placeholder from the debug child
process, while preserving real user and company proxy settings.
### Fixed
- Root `.gitattributes` LFS patterns remain visible while the file is
untracked or ignored, instead of disappearing from the LFS dialog.
- Git LFS pushes rejected with HTTP 413 are retried once with a command-scoped
HTTP/1.1 override, which works around Azure DevOps' large HTTP/2 upload
behavior without changing repository or global Git settings.
- LFS and other generic push failures no longer trigger the unrelated
Pull/Push retry flow intended only for non-fast-forward rejections.
## [2026.8.5] - 2026-08-17
### Added
@@ -18,14 +86,23 @@ The project uses calendar-style versions in the form `YYYY.M.PATCH`.
existing file actions.
- Files and folders in the Changes panel now have context-menu actions for
staging or unstaging their scope and for creating a stash containing only
the selected file or folder.
the selected file or folder. New and untracked items can also be added to
the repository `.gitignore` from Changes or the File Explorer as an exact
file, a complete folder, or an extension-wide pattern. Folder rules are only
offered for folder selections. Tracked files and folders can be removed from
the Git index without deleting their working-tree contents.
- Gitty can open a repository directly at startup through the `--repo PATH` or
`--repo=PATH` command-line argument.
- The executable can clone and immediately open a repository with
`clone REMOTE TARGET`, `--clone REMOTE TARGET`, or `--clone=REMOTE TARGET`.
Relative targets use the caller's working directory, and requests are also
forwarded to an already-running Gitty instance.
### Changed
- A successful Git pull now detects repositories that use LFS and downloads
the required LFS objects automatically with the same remote and credentials.
- Successful clones and pulls now detect repositories that use LFS and
download the required LFS objects automatically with the same remote and
credentials. Fresh clones also activate LFS locally before they are opened.
- Unstaged and staged changes use an equal-width side-by-side layout with
independent scrolling, directional stage/unstage actions, and a responsive
vertical fallback. The List/Tree switch is centered above both areas.
@@ -213,6 +290,9 @@ The project uses calendar-style versions in the form `YYYY.M.PATCH`.
[2026.07.22]: https://git.cbsk-tech.de/Christoph/GitLite/releases/tag/2026.7.22
[2026.07.21]: https://git.cbsk-tech.de/Christoph/GitLite/releases/tag/2026.7.21
[2026.7.20]: https://git.cbsk-tech.de/Christoph/GitLite/releases/tag/2026.7.20
[2026.8.8]: https://git.cbsk-tech.de/Christoph/GitLite/releases/tag/2026.8.8
[2026.8.7]: https://git.cbsk-tech.de/Christoph/GitLite/releases/tag/2026.8.7
[2026.8.6]: https://git.cbsk-tech.de/Christoph/GitLite/releases/tag/2026.8.6
[2026.8.5]: https://git.cbsk-tech.de/Christoph/GitLite/releases/tag/2026.8.5
[2026.8.4]: https://git.cbsk-tech.de/Christoph/GitLite/releases/tag/2026.8.4
[2026.8.3]: https://git.cbsk-tech.de/Christoph/GitLite/releases/tag/2026.8.3
+1 -1
View File
@@ -1,7 +1,7 @@
# Maintainer: Christoph Brandau <c.brandau91@googlemail.com>
pkgname=gitty-desktop-bin
pkgver=2026.8.5
pkgver=2026.8.6
pkgrel=1
pkgdesc="A lightweight, modern Git client built with Tauri (prebuilt Arch package)"
arch=('x86_64')
+56 -5
View File
@@ -20,6 +20,7 @@ Fast, simple, and designed for developers who want a clean Git experience withou
- 🔄 Pull, Push & Fetch
- 🔀 Merge & Rebase
- 📦 Repository management
- ☁️ GitHub, GitLab, Azure DevOps, and Gitea integrations
- 🗄️ Git LFS detection, tracking and object management
- 🎨 Modern and intuitive UI
@@ -82,17 +83,67 @@ files.
---
## Command line
Open an existing repository when Gitty starts:
```text
gitty.exe --repo "D:\Projects\ExistingRepo"
```
Clone a remote into an exact local target folder and open it immediately:
```text
gitty.exe --clone "https://example.com/team/project.git" "D:\Projects\Project"
gitty clone "git@example.com:team/project.git" "D:\Projects\Project"
```
`--clone=<REMOTE>` is also accepted. Relative target paths are resolved from
the current working directory. Clone and repository requests are forwarded to
the running window when Gitty is already open.
---
## Git hosting integrations
Gitty connects to GitHub, GitLab.com, GitLab Self-Managed, Azure DevOps, and
Gitea from **Settings → Integrations**. Each connection uses a personal access
token that is stored in the operating system keychain instead of application
settings. Azure DevOps can manage multiple organizations with separate URLs,
usernames, and tokens.
After enabling a connection, open **Clone → Integrations** to load the
repositories available to that account. Repositories are sorted
alphabetically and can be filtered, refreshed, selected, and cloned directly
with the stored credentials.
---
## Development
Start the complete desktop application in development mode with:
```bash
npm run tauri:dev
```
The development launcher preserves normal proxy settings. If a sandboxed
development terminal injects the non-routing `127.0.0.1:9` proxy or its
blocking SSH placeholder, those values are removed only for the Tauri child
process so Git remotes and Git LFS remain testable in the debug application.
---
## Git LFS
Gitty bundles the `git-lfs` executable in its desktop installers and checks it
at runtime before offering LFS actions. Arch packages also declare `git-lfs` as
a dependency so Git hooks and command-line workflows outside Gitty use the same
extension. The repository toolbar exposes LFS setup, tracked patterns, object
downloads, and safe cache pruning. Normal clone, pull, checkout, and push
operations continue to use Git's standard LFS filters and pre-push hook. After
every successful pull, Gitty detects LFS usage and automatically downloads the
required LFS objects with the same remote and credentials, so no second pull is
needed.
downloads, and safe cache pruning. After every successful clone or pull, Gitty
detects LFS usage and automatically downloads the required LFS objects with the
same remote and credentials, so no second pull is needed. Fresh clones also get
repository-local LFS filters and the pre-push hook before they are opened.
---
+17
View File
@@ -101,6 +101,20 @@ interface GitLfsFile {
oid: string;
version: string;
}
type GitIntegrationProvider = "github" | "gitlab" | "gitlab-self-hosted" | "azure-devops" | "gitea";
interface IntegrationRepository {
id: string;
name: string;
fullName: string;
description: string;
cloneUrl: string;
sshUrl: string;
webUrl: string;
updatedAt: string;
private: boolean;
}
```
## Commands
@@ -110,6 +124,7 @@ The command list below includes the repository-management and synchronization AP
- `open_repository(path: string): Promise<GitStatus>`
- `init_repository(path: string, initialBranch?: string): Promise<GitStatus>`
- `clone_repository(...): Promise<RepositoryBundle>`
- `list_integration_repositories(provider: GitIntegrationProvider, baseUrl: string, accountId?: string): Promise<IntegrationRepository[]>`; loads credentials from the operating system keychain and returns every repository accessible through the configured Git hosting account.
- `get_status(path: string): Promise<GitStatus>`
- `git_lfs_status(path: string): Promise<GitLfsStatus>`
- `git_lfs_install(path: string): Promise<GitLfsStatus>`
@@ -137,6 +152,8 @@ The command list below includes the repository-management and synchronization AP
- `repair_worktree(path: string, worktreePath: string): Promise<GitWorktree[]>`
- `stage_files(path: string, files: string[]): Promise<GitStatus>`
- `unstage_files(path: string, files: string[]): Promise<GitStatus>`
- `add_to_gitignore(path: string, target: string, kind: "file" | "extension" | "folder"): Promise<GitStatus>`; appends a repository-root `.gitignore` rule and unstages newly-added matching files.
- `untrack_paths(path: string, targets: string[]): Promise<GitStatus>`; removes files or folders from the Git index while preserving their working-tree contents.
- `restore_files(path: string, files: string[], staged: boolean): Promise<GitStatus>`
- `stash_push(path: string, message?: string, includeUntracked?: boolean, paths?: string[]): Promise<GitStatus>`; when `paths` is provided, only matching files are stashed.
- `commit(path: string, message: string): Promise<GitStatus>`
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "gitty",
"version": "2026.8.5",
"version": "2026.8.9",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "gitty",
"version": "2026.8.5",
"version": "2026.8.9",
"dependencies": {
"@lucide/svelte": "^1.21.0",
"@tailwindcss/vite": "^4.3.1",
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "gitty",
"version": "2026.8.5",
"version": "2026.8.9",
"private": true,
"type": "module",
"scripts": {
@@ -10,7 +10,7 @@
"icons": "node scripts/generate-app-icons.mjs",
"preview": "vite preview --host 127.0.0.1",
"tauri": "tauri",
"tauri:dev": "tauri dev",
"tauri:dev": "node scripts/tauri-dev.mjs",
"tauri:build": "tauri build",
"check": "svelte-check --tsconfig ./tsconfig.json"
},
+61
View File
@@ -0,0 +1,61 @@
import { spawn } from "node:child_process";
const debugEnvironment = { ...process.env };
const clearedVariables = [];
const blockedProxy = /^https?:\/\/127\.0\.0\.1:9\/?$/i;
const proxyVariables = new Set([
"all_proxy",
"http_proxy",
"https_proxy",
"git_http_proxy",
"git_https_proxy",
]);
for (const [name, value] of Object.entries(debugEnvironment)) {
if (proxyVariables.has(name.toLowerCase()) && blockedProxy.test(value ?? "")) {
delete debugEnvironment[name];
clearedVariables.push(name);
}
}
for (const [name, value] of Object.entries(debugEnvironment)) {
if (
name.toLowerCase() === "git_ssh_command"
&& /^cmd(?:\.exe)?\s+\/c\s+exit\s+1$/i.test((value ?? "").trim())
) {
delete debugEnvironment[name];
clearedVariables.push(name);
}
}
if (process.argv.includes("--check-environment")) {
process.stdout.write(
clearedVariables.length > 0
? `Debug environment ready; cleared: ${clearedVariables.sort().join(", ")}\n`
: "Debug environment ready; no blocked proxy variables found.\n",
);
process.exit(0);
}
if (clearedVariables.length > 0) {
process.stdout.write(
`Starting Gitty without the blocked debug proxy (${clearedVariables.sort().join(", ")}).\n`,
);
}
const isWindows = process.platform === "win32";
const child = spawn(isWindows ? "tauri.cmd" : "tauri", ["dev"], {
cwd: process.cwd(),
env: debugEnvironment,
stdio: "inherit",
shell: isWindows,
});
child.on("error", (error) => {
process.stderr.write(`Could not start Tauri development mode: ${error.message}\n`);
process.exitCode = 1;
});
child.on("exit", (code) => {
process.exitCode = code ?? 1;
});
+37 -3229
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -20,7 +20,7 @@ tauri-plugin-dialog = "=2.7.0"
tauri-plugin-aptabase = "1.0"
keyring = { version = "3", features = ["apple-native", "windows-native", "async-secret-service", "crypto-rust", "async-io"] }
commit_ai = { path = "crates/commit_ai" }
tokio = "1.52.3"
tokio = { version = "1.52.3", features = ["macros", "rt-multi-thread"] }
log = "0.4"
reqwest = { version = "0.12", default-features = false, features = ["blocking", "json", "rustls-tls"] }
sysinfo = { version = "=0.38.3", default-features = false, features = ["system"] }
-2
View File
@@ -5,8 +5,6 @@ version = "0.1.0"
edition = "2024"
[dependencies]
mistralrs = "0.8"
tokio = { version = "1", features = ["sync"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] }
+6 -359
View File
@@ -5,318 +5,8 @@ pub use cloud::{
review_openai, split_anthropic, split_custom, split_openai,
};
use std::{
collections::hash_map::DefaultHasher,
hash::{Hash, Hasher},
sync::Arc,
};
use mistralrs::{GgufModelBuilder, Model, RequestBuilder, TextMessageRole};
use tokio::sync::RwLock;
/// One selectable local (on-device) model. Larger models produce better commit messages
/// but take longer to download (first run only, then cached) and run slower on CPU.
#[derive(Debug, Clone, serde::Serialize)]
pub struct LocalModelOption {
pub id: &'static str,
pub label: &'static str,
pub approx_size_mb: u32,
repo: &'static str,
file: &'static str,
tokenizer_repo: &'static str,
}
pub const DEFAULT_LOCAL_MODEL_ID: &str = "qwen2.5-0.5b";
pub const LOCAL_MODELS: &[LocalModelOption] = &[
LocalModelOption {
id: "qwen2.5-0.5b",
label: "Qwen2.5 0.5B Instruct — fast, lower quality",
approx_size_mb: 490,
repo: "Qwen/Qwen2.5-0.5B-Instruct-GGUF",
file: "qwen2.5-0.5b-instruct-q4_k_m.gguf",
tokenizer_repo: "Qwen/Qwen2.5-0.5B-Instruct",
},
LocalModelOption {
id: "qwen2.5-1.5b",
label: "Qwen2.5 1.5B Instruct — recommended",
approx_size_mb: 1050,
repo: "Qwen/Qwen2.5-1.5B-Instruct-GGUF",
file: "qwen2.5-1.5b-instruct-q4_k_m.gguf",
tokenizer_repo: "Qwen/Qwen2.5-1.5B-Instruct",
},
LocalModelOption {
id: "qwen2.5-3b",
label: "Qwen2.5 3B Instruct — best quality, slower",
approx_size_mb: 2100,
repo: "Qwen/Qwen2.5-3B-Instruct-GGUF",
file: "qwen2.5-3b-instruct-q4_k_m.gguf",
tokenizer_repo: "Qwen/Qwen2.5-3B-Instruct",
},
];
fn find_local_model(model_id: &str) -> Option<&'static LocalModelOption> {
LOCAL_MODELS.iter().find(|option| option.id == model_id)
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum LocalGenerationProfile {
Fast,
Balanced,
Detailed,
}
impl Default for LocalGenerationProfile {
fn default() -> Self {
Self::Fast
}
}
impl LocalGenerationProfile {
pub fn from_id(value: Option<&str>) -> Self {
match value
.unwrap_or_default()
.trim()
.to_ascii_lowercase()
.as_str()
{
"balanced" => Self::Balanced,
"detailed" => Self::Detailed,
_ => Self::Fast,
}
}
pub fn diff_unified_context(self) -> &'static str {
match self {
Self::Fast => "--unified=1",
Self::Balanced => "--unified=2",
Self::Detailed => "--unified=3",
}
}
fn max_diff_chars(self) -> usize {
match self {
Self::Fast => 8_000,
Self::Balanced => 12_000,
Self::Detailed => 24_000,
}
}
fn max_output_tokens(self) -> usize {
match self {
Self::Fast => 160,
Self::Balanced => 360,
Self::Detailed => 750,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize)]
#[serde(rename_all = "lowercase")]
pub enum CommitAiPhase {
/// Nothing has been requested yet.
Idle,
/// Downloading (first run only, then cached by hf-hub) and/or loading into memory.
Loading,
Ready,
Error,
}
#[derive(Debug, Clone, serde::Serialize)]
pub struct CommitAiStatus {
pub phase: CommitAiPhase,
pub model_id: Option<String>,
pub error: Option<String>,
}
struct Inner {
phase: CommitAiPhase,
model_id: Option<String>,
error: Option<String>,
model: Option<Arc<Model>>,
cache: Option<GenerationCache>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
struct GenerationCacheKey {
model_id: String,
profile: LocalGenerationProfile,
input_hash: u64,
}
#[derive(Debug, Clone)]
struct GenerationCache {
key: GenerationCacheKey,
message: String,
}
/// Manages the local (on-device) model only. Cloud providers are stateless HTTP calls
/// (see [`cloud`]) and don't need this — there's nothing to download or keep loaded.
#[derive(Clone)]
pub struct CommitAiEngine {
inner: Arc<RwLock<Inner>>,
}
impl Default for CommitAiEngine {
fn default() -> Self {
Self {
inner: Arc::new(RwLock::new(Inner {
phase: CommitAiPhase::Idle,
model_id: None,
error: None,
model: None,
cache: None,
})),
}
}
}
impl CommitAiEngine {
pub fn new() -> Self {
Self::default()
}
pub async fn status(&self) -> CommitAiStatus {
let guard = self.inner.read().await;
CommitAiStatus {
phase: guard.phase,
model_id: guard.model_id.clone(),
error: guard.error.clone(),
}
}
/// Downloads (first run only; hf-hub caches the files afterwards) and loads the given
/// local model. Safe to call repeatedly — a call for the model that's already
/// ready/loading is a no-op; a call for a *different* model switches to it (the
/// previous one is dropped once no generation is still using it).
pub async fn ensure_loaded(&self, model_id: &str) {
{
let guard = self.inner.read().await;
let same_model = guard.model_id.as_deref() == Some(model_id);
if same_model && matches!(guard.phase, CommitAiPhase::Ready | CommitAiPhase::Loading) {
return;
}
}
let Some(option) = find_local_model(model_id) else {
let mut guard = self.inner.write().await;
guard.phase = CommitAiPhase::Error;
guard.model_id = Some(model_id.to_string());
guard.error = Some(format!("Unknown local model: {model_id}"));
guard.cache = None;
return;
};
{
let mut guard = self.inner.write().await;
guard.phase = CommitAiPhase::Loading;
guard.model_id = Some(model_id.to_string());
guard.error = None;
guard.model = None;
guard.cache = None;
}
let result = GgufModelBuilder::new(option.repo, vec![option.file])
.with_tok_model_id(option.tokenizer_repo)
.with_logging()
.build()
.await;
let mut guard = self.inner.write().await;
// If the user switched to yet another model while this one was loading, drop this
// (now stale) result instead of overwriting the newer request's state.
if guard.model_id.as_deref() != Some(model_id) {
return;
}
match result {
Ok(model) => {
guard.model = Some(Arc::new(model));
guard.phase = CommitAiPhase::Ready;
guard.error = None;
guard.cache = None;
}
Err(err) => {
guard.phase = CommitAiPhase::Error;
guard.error = Some(err.to_string());
guard.cache = None;
}
}
}
pub async fn generate_commit_message(
&self,
diff: &str,
notes: Option<&str>,
profile: LocalGenerationProfile,
) -> Result<String, String> {
let (model, cache_key) = {
let guard = self.inner.read().await;
match (guard.phase, &guard.model) {
(CommitAiPhase::Ready, Some(model)) => {
let cache_key = GenerationCacheKey {
model_id: guard.model_id.clone().unwrap_or_default(),
profile,
input_hash: generation_input_hash(diff, notes),
};
if let Some(cache) = &guard.cache {
if cache.key == cache_key {
return Ok(cache.message.clone());
}
}
(model.clone(), cache_key)
}
_ => return Err("The local AI model is not ready yet.".to_string()),
}
};
let (system, user) = build_local_messages(diff, notes, profile)?;
let request = RequestBuilder::new()
.set_sampler_max_len(profile.max_output_tokens())
.add_message(TextMessageRole::System, system)
.add_message(TextMessageRole::User, user);
let response = model
.send_chat_request(request)
.await
.map_err(|err| err.to_string())?;
let content = response
.choices
.first()
.and_then(|choice| choice.message.content.clone())
.ok_or_else(|| "The model did not return a response.".to_string())?;
let message = sanitize_message(&content);
if message.is_empty() {
return Err("The model did not return a response.".to_string());
}
if looks_like_diff_echo(&message) {
return Err(
"The local model returned the diff instead of a commit message. Try a larger local model (1.5B or 3B) or a cloud provider.".to_string(),
);
}
{
let mut guard = self.inner.write().await;
guard.cache = Some(GenerationCache {
key: cache_key,
message: message.clone(),
});
}
Ok(message)
}
}
fn generation_input_hash(diff: &str, notes: Option<&str>) -> u64 {
let mut hasher = DefaultHasher::new();
diff.hash(&mut hasher);
notes.unwrap_or("").hash(&mut hasher);
hasher.finish()
}
/// Models occasionally ignore the "no code fences" instruction (small local models
/// especially) — strip a wrapping ``` fence and wrapping quotes so the result can go
/// straight into the commit-message box.
/// Strip a wrapping code fence and wrapping quotes so the result can go straight into
/// the commit-message box.
pub(crate) fn sanitize_message(raw: &str) -> String {
let mut text = raw.trim().to_string();
if text.starts_with("```") {
@@ -333,9 +23,9 @@ pub(crate) fn sanitize_message(raw: &str) -> String {
trimmed.to_string()
}
/// Weak models (small local ones especially) sometimes just echo the prompt's diff
/// sections back instead of writing a commit message. Catch that so the UI can show a
/// clear error instead of dumping raw diff text into the commit-message box.
/// Some models echo the prompt's diff sections instead of writing a commit message.
/// Catch that so the UI can show a clear error instead of dumping raw diff text into
/// the commit-message box.
pub(crate) fn looks_like_diff_echo(message: &str) -> bool {
let lower = message.to_ascii_lowercase();
lower.contains("diff --git")
@@ -358,55 +48,12 @@ fn truncate_at_char_boundary(input: &str, max_chars: usize) -> String {
format!("{}\n\n[... diff truncated ...]", &input[..cut])
}
pub(crate) fn build_local_messages(
diff: &str,
notes: Option<&str>,
profile: LocalGenerationProfile,
) -> Result<(String, String), String> {
if diff.trim().is_empty() {
return Err("No staged changes available for a commit message.".to_string());
}
let diff = truncate_at_char_boundary(diff, profile.max_diff_chars());
// Appended to every profile below: small local models occasionally just echo the input
// (the "Staged files:" / "Diff stat:" / "Detailed diff:" sections built in git.rs's
// `staged_diff_local`) instead of writing a new commit message. Naming those exact
// section headers here makes the failure mode explicit enough for weak models to avoid.
const ANTI_ECHO: &str = " Never repeat, quote, or paraphrase the diff or its headers — \
do not include 'diff --git', '@@', 'Staged files:', 'Diff stat:', or 'Detailed diff:' \
anywhere in your answer.";
let system = match profile {
LocalGenerationProfile::Fast => {
format!(
"You generate Git commit messages. Respond only with one Conventional Commits subject line: <type>(<scope>): <subject>. Max 72 characters. No body, bullets, preamble, explanation, code fences, or quotes. Answer in English.{ANTI_ECHO}"
)
}
LocalGenerationProfile::Balanced => {
format!(
"You generate Git commit messages. Respond with a Conventional Commits subject line, then a blank line, then at most two short bullet points. Keep every line under 72 characters. No preamble, explanation, code fences, or quotes. Answer in English.{ANTI_ECHO}"
)
}
LocalGenerationProfile::Detailed => {
format!(
"You generate Git commit messages. Respond with a Conventional Commits subject line, then a blank line, then a concise body and up to four short bullet points grouped by affected area/file. Keep every line under 72 characters. No preamble, explanation, code fences, or quotes. Answer in English.{ANTI_ECHO}"
)
}
};
let mut user = String::new();
if let Some(n) = notes.filter(|n| !n.trim().is_empty()) {
user.push_str(&format!("Developer notes:\n{n}\n\n"));
}
user.push_str(&format!("Staged changes:\n{diff}"));
Ok((system, user))
}
pub(crate) fn build_messages(diff: &str, notes: Option<&str>) -> Result<(String, String), String> {
if diff.trim().is_empty() {
return Err("No staged changes available for a commit message.".to_string());
}
// Rough token estimate — small models often have an 8-32k context window.
// Rough token estimate to keep requests within common context windows.
const MAX_CHARS: usize = 24_000;
let diff = truncate_at_char_boundary(diff, MAX_CHARS);
+963 -137
View File
File diff suppressed because it is too large Load Diff
+457
View File
@@ -0,0 +1,457 @@
use crate::git::load_stored_credential;
use reqwest::blocking::{Client, Response};
use reqwest::header::{ACCEPT, USER_AGENT};
use serde::{Deserialize, Serialize};
use std::time::Duration;
const PAGE_SIZE: usize = 100;
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct IntegrationRepository {
pub id: String,
pub name: String,
pub full_name: String,
pub description: String,
pub clone_url: String,
pub ssh_url: String,
pub web_url: String,
pub updated_at: String,
pub private: bool,
}
#[derive(Debug, Deserialize)]
struct GitLabProject {
id: u64,
name: String,
path_with_namespace: String,
#[serde(default)]
description: Option<String>,
http_url_to_repo: String,
#[serde(default)]
ssh_url_to_repo: String,
#[serde(default)]
web_url: String,
#[serde(default)]
last_activity_at: String,
#[serde(default)]
visibility: String,
}
#[derive(Debug, Deserialize)]
struct GitHubRepository {
id: u64,
name: String,
full_name: String,
#[serde(default)]
description: Option<String>,
clone_url: String,
#[serde(default)]
ssh_url: String,
#[serde(default)]
html_url: String,
#[serde(default)]
updated_at: String,
#[serde(default)]
private: bool,
}
#[derive(Debug, Deserialize)]
struct GiteaRepository {
id: u64,
name: String,
full_name: String,
#[serde(default)]
description: String,
clone_url: String,
#[serde(default)]
ssh_url: String,
#[serde(default)]
html_url: String,
#[serde(default)]
updated_at: String,
#[serde(default)]
private: bool,
}
#[derive(Debug, Deserialize)]
struct AzureRepositoryList {
#[serde(default)]
value: Vec<AzureRepository>,
}
#[derive(Debug, Deserialize)]
struct AzureRepository {
id: String,
name: String,
project: AzureProject,
#[serde(default, rename = "remoteUrl")]
remote_url: String,
#[serde(default, rename = "sshUrl")]
ssh_url: String,
#[serde(default, rename = "webUrl")]
web_url: String,
}
#[derive(Debug, Deserialize)]
struct AzureProject {
name: String,
}
fn integration_key(provider: &str, account_id: Option<&str>) -> Result<String, String> {
if provider == "azure-devops" {
if let Some(account_id) = account_id.filter(|value| !value.is_empty()) {
if account_id.len() > 80
|| !account_id.chars().all(|character| {
character.is_ascii_alphanumeric() || matches!(character, '-' | '_')
})
{
return Err("Invalid integration account identifier.".to_string());
}
if account_id != "default" {
return Ok(format!("integration:{provider}:{account_id}"));
}
}
}
Ok(format!("integration:{provider}"))
}
fn client() -> Result<Client, String> {
Client::builder()
.timeout(Duration::from_secs(25))
.build()
.map_err(|err| format!("Could not initialize the integration client: {err}"))
}
fn normalized_base_url(base_url: &str) -> Result<String, String> {
let base_url = base_url.trim().trim_end_matches('/');
if !(base_url.starts_with("https://") || base_url.starts_with("http://")) {
return Err("The integration URL must start with http:// or https://.".to_string());
}
Ok(base_url.to_string())
}
fn github_api_base_url(base_url: &str) -> Result<String, String> {
match normalized_base_url(base_url)?.to_ascii_lowercase().as_str() {
"https://github.com" | "https://www.github.com" => Ok("https://api.github.com".to_string()),
"https://api.github.com" => Ok("https://api.github.com".to_string()),
_ => Err("The GitHub integration URL must be https://github.com.".to_string()),
}
}
fn response_error(response: Response, provider: &str) -> String {
let status = response.status();
let detail = response.text().ok().and_then(|body| {
serde_json::from_str::<serde_json::Value>(&body)
.ok()
.and_then(|value| {
value
.get("message")
.or_else(|| value.get("error"))
.and_then(|value| value.as_str())
.map(str::to_string)
})
});
match detail {
Some(detail) if !detail.trim().is_empty() => {
format!("{provider} returned {status}: {detail}")
}
_ => format!("{provider} returned {status}."),
}
}
fn gitlab_repositories(
client: &Client,
base_url: &str,
token: &str,
) -> Result<Vec<IntegrationRepository>, String> {
let mut repositories = Vec::new();
let mut page = 1usize;
loop {
let response = client
.get(format!("{base_url}/api/v4/projects"))
.header(USER_AGENT, "Gitty")
.header(ACCEPT, "application/json")
.header("PRIVATE-TOKEN", token)
.query(&[
("membership", "true"),
("simple", "true"),
("order_by", "last_activity_at"),
("sort", "desc"),
("per_page", &PAGE_SIZE.to_string()),
("page", &page.to_string()),
])
.send()
.map_err(|err| format!("Could not reach GitLab: {err}"))?;
if !response.status().is_success() {
return Err(response_error(response, "GitLab"));
}
let next_page = response
.headers()
.get("x-next-page")
.and_then(|value| value.to_str().ok())
.unwrap_or("")
.to_string();
let projects = response
.json::<Vec<GitLabProject>>()
.map_err(|err| format!("GitLab returned an unreadable repository list: {err}"))?;
repositories.extend(projects.into_iter().map(|project| IntegrationRepository {
id: project.id.to_string(),
name: project.name,
full_name: project.path_with_namespace,
description: project.description.unwrap_or_default(),
clone_url: project.http_url_to_repo,
ssh_url: project.ssh_url_to_repo,
web_url: project.web_url,
updated_at: project.last_activity_at,
private: project.visibility == "private",
}));
if next_page.is_empty() {
break;
}
page = next_page.parse().unwrap_or(page + 1);
}
Ok(repositories)
}
fn github_repositories(
client: &Client,
base_url: &str,
token: &str,
) -> Result<Vec<IntegrationRepository>, String> {
let api_base_url = github_api_base_url(base_url)?;
let mut repositories = Vec::new();
let mut page = 1usize;
loop {
let response = client
.get(format!("{api_base_url}/user/repos"))
.header(USER_AGENT, "Gitty")
.header(ACCEPT, "application/vnd.github+json")
.header("Authorization", format!("Bearer {token}"))
.header("X-GitHub-Api-Version", "2026-03-10")
.query(&[
("per_page", PAGE_SIZE.to_string()),
("page", page.to_string()),
("sort", "updated".to_string()),
("direction", "desc".to_string()),
])
.send()
.map_err(|err| format!("Could not reach GitHub: {err}"))?;
if !response.status().is_success() {
return Err(response_error(response, "GitHub"));
}
let page_repositories = response
.json::<Vec<GitHubRepository>>()
.map_err(|err| format!("GitHub returned an unreadable repository list: {err}"))?;
let count = page_repositories.len();
repositories.extend(page_repositories.into_iter().map(|repository| {
IntegrationRepository {
id: repository.id.to_string(),
name: repository.name,
full_name: repository.full_name,
description: repository.description.unwrap_or_default(),
clone_url: repository.clone_url,
ssh_url: repository.ssh_url,
web_url: repository.html_url,
updated_at: repository.updated_at,
private: repository.private,
}
}));
if count < PAGE_SIZE {
break;
}
page += 1;
}
Ok(repositories)
}
fn gitea_repositories(
client: &Client,
base_url: &str,
token: &str,
) -> Result<Vec<IntegrationRepository>, String> {
let mut repositories = Vec::new();
let mut page = 1usize;
loop {
let response = client
.get(format!("{base_url}/api/v1/user/repos"))
.header(USER_AGENT, "Gitty")
.header(ACCEPT, "application/json")
.header("Authorization", format!("token {token}"))
.query(&[
("limit", PAGE_SIZE.to_string()),
("page", page.to_string()),
("sort", "updated".to_string()),
])
.send()
.map_err(|err| format!("Could not reach Gitea: {err}"))?;
if !response.status().is_success() {
return Err(response_error(response, "Gitea"));
}
let page_repositories = response
.json::<Vec<GiteaRepository>>()
.map_err(|err| format!("Gitea returned an unreadable repository list: {err}"))?;
let count = page_repositories.len();
repositories.extend(page_repositories.into_iter().map(|repository| {
IntegrationRepository {
id: repository.id.to_string(),
name: repository.name,
full_name: repository.full_name,
description: repository.description,
clone_url: repository.clone_url,
ssh_url: repository.ssh_url,
web_url: repository.html_url,
updated_at: repository.updated_at,
private: repository.private,
}
}));
if count < PAGE_SIZE {
break;
}
page += 1;
}
Ok(repositories)
}
fn azure_repositories(
client: &Client,
base_url: &str,
username: &str,
token: &str,
) -> Result<Vec<IntegrationRepository>, String> {
let response = client
.get(format!("{base_url}/_apis/git/repositories"))
.header(USER_AGENT, "Gitty")
.header(ACCEPT, "application/json")
.basic_auth(username, Some(token))
.query(&[("api-version", "7.1")])
.send()
.map_err(|err| format!("Could not reach Azure DevOps: {err}"))?;
if !response.status().is_success() {
return Err(response_error(response, "Azure DevOps"));
}
let repositories = response
.json::<AzureRepositoryList>()
.map_err(|err| format!("Azure DevOps returned an unreadable repository list: {err}"))?;
Ok(repositories
.value
.into_iter()
.map(|repository| IntegrationRepository {
id: repository.id,
full_name: format!("{}/{}", repository.project.name, repository.name),
name: repository.name,
description: String::new(),
clone_url: repository.remote_url,
ssh_url: repository.ssh_url,
web_url: repository.web_url,
updated_at: String::new(),
private: true,
})
.collect())
}
#[tauri::command]
pub async fn list_integration_repositories(
provider: String,
base_url: String,
account_id: Option<String>,
) -> Result<Vec<IntegrationRepository>, String> {
tauri::async_runtime::spawn_blocking(move || {
let credential_key = integration_key(&provider, account_id.as_deref())?;
let credential = load_stored_credential(&credential_key)?
.ok_or_else(|| "No token is stored for this integration.".to_string())?;
let base_url = normalized_base_url(&base_url)?;
let client = client()?;
match provider.as_str() {
"github" => github_repositories(&client, &base_url, &credential.password),
"gitlab" | "gitlab-self-hosted" => {
gitlab_repositories(&client, &base_url, &credential.password)
}
"azure-devops" => azure_repositories(
&client,
&base_url,
if credential.username.trim().is_empty() {
"gitty"
} else {
&credential.username
},
&credential.password,
),
"gitea" => gitea_repositories(&client, &base_url, &credential.password),
_ => Err("Unsupported integration provider.".to_string()),
}
})
.await
.map_err(|err| format!("Could not load integration repositories: {err}"))?
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn base_urls_are_normalized_and_validated() {
assert_eq!(
normalized_base_url(" https://gitlab.example.com/ ").unwrap(),
"https://gitlab.example.com"
);
assert!(normalized_base_url("gitlab.example.com").is_err());
assert_eq!(
github_api_base_url("https://github.com/").unwrap(),
"https://api.github.com"
);
assert!(github_api_base_url("https://github.example.com").is_err());
}
#[test]
fn integration_credential_keys_match_the_frontend() {
assert_eq!(
integration_key("github", None).unwrap(),
"integration:github"
);
assert_eq!(integration_key("gitea", None).unwrap(), "integration:gitea");
assert_eq!(
integration_key("azure-devops", Some("org-123")).unwrap(),
"integration:azure-devops:org-123"
);
assert_eq!(
integration_key("azure-devops", Some("default")).unwrap(),
"integration:azure-devops"
);
assert!(integration_key("azure-devops", Some("../invalid")).is_err());
}
#[test]
fn provider_repository_payloads_deserialize() {
let github: Vec<GitHubRepository> = serde_json::from_str(
r#"[{"id":6,"name":"desktop","full_name":"team/desktop","description":null,"clone_url":"https://github.com/team/desktop.git","ssh_url":"git@github.com:team/desktop.git","html_url":"https://github.com/team/desktop","updated_at":"2026-08-29T09:00:00Z","private":true}]"#,
)
.unwrap();
assert_eq!(github[0].full_name, "team/desktop");
assert!(github[0].description.is_none());
let gitlab: Vec<GitLabProject> = serde_json::from_str(
r#"[{"id":7,"name":"app","path_with_namespace":"team/app","description":"Demo","http_url_to_repo":"https://gitlab.test/team/app.git","ssh_url_to_repo":"git@gitlab.test:team/app.git","web_url":"https://gitlab.test/team/app","last_activity_at":"2026-08-29T10:00:00Z","visibility":"private"}]"#,
)
.unwrap();
assert_eq!(gitlab[0].path_with_namespace, "team/app");
assert_eq!(gitlab[0].visibility, "private");
let gitea: Vec<GiteaRepository> = serde_json::from_str(
r#"[{"id":8,"name":"api","full_name":"team/api","description":"","clone_url":"https://gitea.test/team/api.git","ssh_url":"git@gitea.test:team/api.git","html_url":"https://gitea.test/team/api","updated_at":"2026-08-29T11:00:00Z","private":false}]"#,
)
.unwrap();
assert_eq!(gitea[0].full_name, "team/api");
assert!(!gitea[0].private);
let azure: AzureRepositoryList = serde_json::from_str(
r#"{"value":[{"id":"repo-id","name":"web","project":{"name":"Platform"},"remoteUrl":"https://dev.azure.com/org/Platform/_git/web","sshUrl":"git@ssh.dev.azure.com:v3/org/Platform/web","webUrl":"https://dev.azure.com/org/Platform/_git/web"}]}"#,
)
.unwrap();
assert_eq!(azure.value[0].project.name, "Platform");
assert_eq!(
azure.value[0].remote_url,
"https://dev.azure.com/org/Platform/_git/web"
);
}
}
+164 -44
View File
@@ -3,6 +3,7 @@
mod badge;
mod external_tools;
mod git;
mod integrations;
mod telemetry;
use badge::set_sync_badge;
@@ -10,28 +11,28 @@ use external_tools::{
detect_external_tools, launch_external_diff, launch_external_merge, launch_external_tool,
};
use git::{
SearchCancellationState, add_remote, add_worktree, amend_commit, apply_file_patch,
cancel_code_search, cancel_file_history, checkout_branch, cherry_pick_abort,
SearchCancellationState, add_remote, add_to_gitignore, add_worktree, amend_commit,
apply_file_patch, cancel_code_search, cancel_file_history, checkout_branch, cherry_pick_abort,
cherry_pick_commit, cherry_pick_continue, clone_repository, commit, commit_ai_generate,
commit_ai_load, commit_ai_local_models, commit_ai_review, commit_ai_split, commit_ai_status,
compare_commits, compare_file_to_head, compare_file_to_parent, create_branch, create_tag,
cred_delete, cred_load, cred_save, delete_branch, delete_commit_note, delete_remote_branch,
delete_remote_branches, delete_tag, diff_file_against_working_tree, fetch, fetch_commit_notes,
get_commit_note, get_file_blame, get_file_patch, get_remote_url, get_status, git_lfs_install,
git_lfs_prune, git_lfs_pull, git_lfs_status, git_lfs_track, git_lfs_untrack, init_repository,
last_commit_message, list_branches, list_commits, list_file_history,
list_interactive_rebase_commits, list_reflog, list_remotes, list_repository_files,
list_stashes, list_tags, list_worktrees, lock_worktree, merge_abort, merge_branch,
merge_continue, move_worktree, open_repo_in_explorer, open_repository, open_repository_bundle,
open_repository_file, prune_worktrees, pull, push, push_commit_notes, push_tag, read_conflict,
rebase_abort, rebase_branch, rebase_continue, remove_remote, remove_worktree, rename_branch,
rename_remote_branch, repair_worktree, resolve_conflict, resolve_conflict_side,
restore_file_from_commit, restore_files, restore_reflog_entry, restore_to_commit,
revert_commit, run_sequence_editor_if_requested, search_code_introductions,
set_branch_upstream, set_commit_note, stage_files, start_interactive_rebase, stash_apply,
stash_drop, stash_pop, stash_push, undo_last_commit, unlock_worktree, unstage_files,
update_remote,
commit_ai_review, commit_ai_split, compare_commits, compare_file_to_head,
compare_file_to_parent, create_branch, create_tag, cred_delete, cred_load, cred_save,
delete_branch, delete_commit_note, delete_remote_branch, delete_remote_branches, delete_tag,
diff_file_against_working_tree, fetch, fetch_commit_notes, get_commit_note, get_file_blame,
get_file_patch, get_remote_url, get_status, git_lfs_install, git_lfs_prune, git_lfs_pull,
git_lfs_status, git_lfs_track, git_lfs_untrack, init_repository, last_commit_message,
list_branches, list_commits, list_file_history, list_interactive_rebase_commits, list_reflog,
list_remotes, list_repository_files, list_stashes, list_tags, list_worktrees, lock_worktree,
merge_abort, merge_branch, merge_continue, move_worktree, open_repo_in_explorer,
open_repository, open_repository_bundle, open_repository_file, prune_worktrees, pull, push,
push_commit_notes, push_tag, read_conflict, rebase_abort, rebase_branch, rebase_continue,
remove_remote, remove_worktree, rename_branch, rename_remote_branch, repair_worktree,
resolve_conflict, resolve_conflict_side, restore_file_from_commit, restore_files,
restore_reflog_entry, restore_to_commit, revert_commit, run_sequence_editor_if_requested,
search_code_introductions, set_branch_upstream, set_commit_note, stage_files,
start_interactive_rebase, stash_apply, stash_drop, stash_pop, stash_push, undo_last_commit,
unlock_worktree, unstage_files, untrack_paths, update_remote,
};
use integrations::list_integration_repositories;
use std::path::{Path, PathBuf};
use std::sync::Mutex;
use tauri::{Emitter, Manager};
@@ -39,11 +40,68 @@ use telemetry::{emit_frontend_log, emit_frontend_span, set_telemetry_enabled};
struct StartupRepository(Mutex<Option<String>>);
#[derive(Clone, Debug, PartialEq, Eq, serde::Serialize)]
#[serde(rename_all = "camelCase")]
struct StartupCloneRequest {
remote_url: String,
parent_path: String,
directory_name: String,
}
struct StartupClone(Mutex<Option<StartupCloneRequest>>);
fn resolve_startup_path(path: &str, cwd: &Path) -> Option<PathBuf> {
let path = path.trim();
if path.is_empty() {
return None;
}
let path = PathBuf::from(path);
Some(if path.is_absolute() {
path
} else {
cwd.join(path)
})
}
fn clone_request_from_args(
args: impl IntoIterator<Item = String>,
cwd: &Path,
) -> Option<StartupCloneRequest> {
let mut args = args.into_iter();
while let Some(arg) = args.next() {
let remote_url = if arg == "clone" || arg == "--clone" {
args.next()
} else {
arg.strip_prefix("--clone=").map(ToString::to_string)
};
let Some(remote_url) = remote_url.filter(|value| !value.trim().is_empty()) else {
continue;
};
let target = resolve_startup_path(&args.next()?, cwd)?;
let directory_name = target.file_name()?.to_string_lossy().trim().to_string();
let parent_path = target.parent()?.to_string_lossy().into_owned();
if directory_name.is_empty() || parent_path.trim().is_empty() {
return None;
}
return Some(StartupCloneRequest {
remote_url,
parent_path,
directory_name,
});
}
None
}
fn repository_path_from_args(args: impl IntoIterator<Item = String>, cwd: &Path) -> Option<String> {
let mut args = args.into_iter();
let mut repository = None;
while let Some(arg) = args.next() {
if arg == "clone" || arg == "--clone" || arg.starts_with("--clone=") {
return None;
}
if arg == "--repo" {
repository = args.next();
break;
@@ -58,27 +116,24 @@ fn repository_path_from_args(args: impl IntoIterator<Item = String>, cwd: &Path)
}
}
repository.filter(|path| !path.trim().is_empty()).map(|path| {
let path = PathBuf::from(path);
if path.is_absolute() {
path
} else {
cwd.join(path)
}
.to_string_lossy()
.into_owned()
})
repository
.and_then(|path| resolve_startup_path(&path, cwd))
.map(|path| path.to_string_lossy().into_owned())
}
#[cfg(test)]
mod startup_repository_tests {
use super::repository_path_from_args;
use super::{clone_request_from_args, repository_path_from_args};
use std::path::Path;
#[test]
fn accepts_direct_relative_repository_path() {
let path = repository_path_from_args(["projects/repo".to_string()], Path::new("/home/user"));
assert_eq!(path.as_deref(), Some("/home/user/projects/repo"));
let path =
repository_path_from_args(["projects/repo".to_string()], Path::new("/home/user"));
assert_eq!(
path.map(|value| value.replace('\\', "/")),
Some("/home/user/projects/repo".to_string())
);
}
#[test]
@@ -96,7 +151,60 @@ mod startup_repository_tests {
["--repo=projects/repo".to_string()],
Path::new("/home/user"),
);
assert_eq!(path.as_deref(), Some("/home/user/projects/repo"));
assert_eq!(
path.map(|value| value.replace('\\', "/")),
Some("/home/user/projects/repo".to_string())
);
}
#[test]
fn accepts_clone_command_with_exact_relative_target() {
let request = clone_request_from_args(
[
"clone".to_string(),
"https://example.com/team/project.git".to_string(),
"clones/local-copy".to_string(),
],
Path::new("/home/user"),
)
.expect("clone request should be parsed");
assert_eq!(request.remote_url, "https://example.com/team/project.git");
assert_eq!(request.directory_name, "local-copy");
assert_eq!(request.parent_path.replace('\\', "/"), "/home/user/clones");
}
#[test]
fn accepts_clone_option_and_clone_equals_option() {
for args in [
vec![
"--clone".to_string(),
"git@example.com:team/project.git".to_string(),
"/projects/project".to_string(),
],
vec![
"--clone=git@example.com:team/project.git".to_string(),
"/projects/project".to_string(),
],
] {
let request = clone_request_from_args(args, Path::new("/home/user"))
.expect("clone option should be parsed");
assert_eq!(request.directory_name, "project");
assert_eq!(request.parent_path.replace('\\', "/"), "/projects");
}
}
#[test]
fn repository_parser_does_not_treat_clone_values_as_repository_paths() {
let path = repository_path_from_args(
[
"--clone".to_string(),
"https://example.com/team/project.git".to_string(),
"clones/project".to_string(),
],
Path::new("/home/user"),
);
assert!(path.is_none());
}
}
@@ -105,6 +213,11 @@ fn take_startup_repository(state: tauri::State<'_, StartupRepository>) -> Option
state.0.lock().ok()?.take()
}
#[tauri::command]
fn take_startup_clone(state: tauri::State<'_, StartupClone>) -> Option<StartupCloneRequest> {
state.0.lock().ok()?.take()
}
struct ConsoleLogger;
impl log::Log for ConsoleLogger {
@@ -167,14 +280,20 @@ async fn main() {
return;
}
let startup_repository = repository_path_from_args(
std::env::args().skip(1),
&std::env::current_dir().unwrap_or_default(),
);
let startup_args: Vec<String> = std::env::args().skip(1).collect();
let startup_cwd = std::env::current_dir().unwrap_or_default();
let startup_clone = clone_request_from_args(startup_args.clone(), &startup_cwd);
let startup_repository = repository_path_from_args(startup_args, &startup_cwd);
let builder = tauri::Builder::default()
.plugin(tauri_plugin_single_instance::init(|app, args, cwd| {
if let Some(path) = repository_path_from_args(args.into_iter().skip(1), Path::new(&cwd)) {
let args: Vec<String> = args.into_iter().skip(1).collect();
if let Some(request) = clone_request_from_args(args.clone(), Path::new(&cwd)) {
if let Ok(mut pending) = app.state::<StartupClone>().0.lock() {
*pending = Some(request);
}
let _ = app.emit("open-startup-repository", ());
} else if let Some(path) = repository_path_from_args(args, Path::new(&cwd)) {
if let Ok(mut pending) = app.state::<StartupRepository>().0.lock() {
*pending = Some(path);
}
@@ -195,8 +314,8 @@ async fn main() {
.build(),
)
.manage(StartupRepository(Mutex::new(startup_repository)))
.manage(StartupClone(Mutex::new(startup_clone)))
.manage(SearchCancellationState::default())
.manage(commit_ai::CommitAiEngine::new())
.plugin(tauri_plugin_dialog::init());
// Linux installs are expected to come from the system package manager (see the
@@ -254,6 +373,8 @@ async fn main() {
cherry_pick_abort,
stage_files,
unstage_files,
add_to_gitignore,
untrack_paths,
stash_push,
stash_apply,
stash_pop,
@@ -265,9 +386,6 @@ async fn main() {
amend_commit,
undo_last_commit,
last_commit_message,
commit_ai_status,
commit_ai_load,
commit_ai_local_models,
commit_ai_generate,
commit_ai_review,
commit_ai_split,
@@ -311,12 +429,14 @@ async fn main() {
cred_load,
cred_save,
cred_delete,
list_integration_repositories,
set_sync_badge,
close_splashscreen,
set_telemetry_enabled,
emit_frontend_log,
emit_frontend_span,
take_startup_repository
take_startup_repository,
take_startup_clone
])
.run(tauri::generate_context!())
.expect("error while running tauri application");
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "Gitty",
"version": "2026.8.5",
"version": "2026.8.9",
"identifier": "com.gitty",
"build": {
"beforeDevCommand": "npm run prepare:lfs && npm run dev",
+287 -100
View File
@@ -36,6 +36,7 @@
import UpdateToast from "./lib/components/UpdateToast.svelte";
import {
addToGitignore,
amendCommit,
addRemote,
addWorktree,
@@ -48,9 +49,6 @@
commitAiGenerate,
commitAiReview,
commitAiSplit,
commitAiLoad,
commitAiLocalModels,
commitAiStatus,
compareCommits,
cancelCodeSearch,
cancelFileHistory,
@@ -116,6 +114,7 @@
launchExternalMerge,
launchExternalTool,
credLoad,
credDelete,
credSave,
getFilePatch,
readConflict,
@@ -137,6 +136,7 @@
undoLastCommit,
unlockWorktree,
untrackGitLfsPattern,
untrackPaths,
unstageFiles,
} from "./lib/git";
@@ -144,16 +144,20 @@
AiReviewResult,
AiCommitPlan,
AiSettings,
AppAppearance,
AppLanguage,
AppTheme,
AnalyticsSettings,
CommitAiPhase,
CustomThemeColors,
ConflictFile,
DetectedExternalTool,
ExplorerNode,
ExplorerNodeKind,
ExternalDiffScope,
ExternalToolsSettings,
GitIntegrationSecretUpdate,
GitIntegrationSettings,
GitIntegrationProvider,
GitBlameLine,
GitBranch as GitBranchInfo,
GitCommit,
@@ -161,6 +165,7 @@
GitCommitComparison,
GitDiffFile,
GitFileStatus,
GitIgnoreKind,
GitLfsStatus,
GitRepositoryFile,
GitRemote,
@@ -170,7 +175,6 @@
GitStatus,
GitTag,
GitWorktree,
LocalModelOption,
PatchApplyAction,
PreparedResolution,
RebaseCommit,
@@ -185,6 +189,11 @@
normaliseExternalToolsSettings,
resolveDetectedExternalToolPrograms,
} from "./lib/externalTools";
import {
defaultGitIntegrationSettings,
integrationCredentialKey,
normaliseGitIntegrationSettings,
} from "./lib/integrations";
import {
orgKeyFromUrl,
@@ -250,8 +259,11 @@
const AI_SETTINGS_KEY = "gitlite.aiSettings.v1";
const ANALYTICS_SETTINGS_KEY = "gitlite.analyticsSettings.v1";
const APP_THEME_KEY = "gitlite.theme.v1";
const APP_APPEARANCE_KEY = "gitlite.appearance.v1";
const CUSTOM_THEME_KEY = "gitlite.customTheme.v1";
const APP_LANGUAGE_KEY = "gitlite.language.v1";
const EXTERNAL_TOOLS_SETTINGS_KEY = "gitlite.externalTools.v1";
const GIT_INTEGRATIONS_SETTINGS_KEY = "gitlite.integrations.v1";
const AUTO_REFRESH_ENABLED_KEY = "gitlite.autoRefreshEnabled.v1";
const COMMIT_PANEL_HEIGHT_KEY = "gitlite.commitPanelHeight.v1";
const LEFT_SIDEBAR_WIDTH_KEY = "gitlite.leftSidebarWidth.v1";
@@ -285,6 +297,7 @@
let repoPath = "";
let startupReady = false;
let pendingStartupRepoPath = "";
let pendingStartupCloneRequest: CloneRequest | null = null;
let startupRepositoryRetryTimer: ReturnType<typeof setTimeout> | undefined;
let unlistenStartupRepository: (() => void) | undefined;
let activeRepoPath = "";
@@ -342,8 +355,6 @@
let commitMessage = "";
let amendMode = false;
let preAmendDraftMessage = "";
let lastLocalAiGeneratedMessage = "";
let commitAiPhase: CommitAiPhase = "idle";
let commitAiGenerating = false;
let commitAiReviewing = false;
let commitAiSplitting = false;
@@ -351,7 +362,6 @@
let aiCommitSplitOpen = false;
let aiReviewResult: AiReviewResult | null = null;
let aiReviewOpen = false;
let commitAiPollTimer: ReturnType<typeof setInterval> | undefined;
let aiSettings: AiSettings = defaultAiSettings();
let aiSettingsOpen = false;
let appSettingsOpen = false;
@@ -360,13 +370,15 @@
let analyticsNoticeOpen = false;
let analyticsSettings: AnalyticsSettings = defaultAnalyticsSettings();
let appTheme: AppTheme = loadThemePreference();
let appAppearance: AppAppearance = loadAppearancePreference();
let customTheme: CustomThemeColors = loadCustomTheme();
let appLanguage: AppLanguage = loadLanguagePreference();
let externalToolsSettings: ExternalToolsSettings = loadExternalToolsSettings();
let gitIntegrationSettings: GitIntegrationSettings = loadGitIntegrationSettings();
let externalToolsConfigured = hasStoredExternalToolsSettings();
let detectedExternalTools: DetectedExternalTool[] = [];
let externalToolsDetectionPending = true;
let externalToolsDetectionUnavailable = false;
let localModelOptions: LocalModelOption[] = [];
let errorMessage = "";
let operation = "";
let compareFrom = "";
@@ -551,6 +563,7 @@
$: fileManagerToolName = externalToolDisplayName("fileManager", externalToolsSettings.fileManager, detectedExternalTools);
$: applyThemePreference(appTheme);
$: applyAppearancePreference(appAppearance, customTheme);
$: applyLanguagePreference(appLanguage);
// ── Lifecycle ──────────────────────────────────────────────────────────────
@@ -606,7 +619,6 @@
if (autoRefreshTimer) { clearInterval(autoRefreshTimer); autoRefreshTimer = undefined; }
if (backgroundRepoStatusTimer) { clearInterval(backgroundRepoStatusTimer); backgroundRepoStatusTimer = undefined; }
if (backgroundFetchTimer) { clearInterval(backgroundFetchTimer); backgroundFetchTimer = undefined; }
if (commitAiPollTimer) { clearInterval(commitAiPollTimer); commitAiPollTimer = undefined; }
}
function wait(ms: number): Promise<void> {
@@ -659,7 +671,7 @@
loadRepoLists();
void checkForUpdates();
void initCommitAi();
aiSettings = loadAiSettings();
try {
await waitForStartupPaint();
@@ -680,13 +692,21 @@
async function receiveStartupRepository() {
try {
const path = await tracedInvoke<string | null>("take_startup_repository");
if (path) pendingStartupRepoPath = path;
const [path, cloneRequest] = await Promise.all([
tracedInvoke<string | null>("take_startup_repository"),
tracedInvoke<CloneRequest | null>("take_startup_clone"),
]);
if (cloneRequest) {
pendingStartupCloneRequest = cloneRequest;
pendingStartupRepoPath = "";
} else if (path) {
pendingStartupRepoPath = path;
}
} catch {
return;
}
if (!startupReady || !pendingStartupRepoPath) return;
if (!startupReady || (!pendingStartupCloneRequest && !pendingStartupRepoPath)) return;
if (isBusy) {
if (!startupRepositoryRetryTimer) {
startupRepositoryRetryTimer = setTimeout(() => {
@@ -696,6 +716,12 @@
}
return;
}
if (pendingStartupCloneRequest) {
const request = pendingStartupCloneRequest;
pendingStartupCloneRequest = null;
await cloneRepo(request.remoteUrl, request.parentPath, request.directoryName);
return;
}
const path = pendingStartupRepoPath;
pendingStartupRepoPath = "";
await openRepo(path);
@@ -993,48 +1019,10 @@
// ── Commit AI ──────────────────────────────────────────────────────────────
function stopCommitAiPolling() {
if (commitAiPollTimer) { clearInterval(commitAiPollTimer); commitAiPollTimer = undefined; }
}
async function pollCommitAiStatus() {
try {
const result = await commitAiStatus();
commitAiPhase = result.phase;
} catch { /* ignore transient errors */ }
if (commitAiPhase === "ready" || commitAiPhase === "error") stopCommitAiPolling();
}
function startCommitAiPolling() {
// Only the local model has a download/load phase worth polling — cloud providers are
// plain API calls with nothing to wait for.
stopCommitAiPolling();
if (aiSettings.provider !== "local") return;
void pollCommitAiStatus();
commitAiPollTimer = setInterval(() => { void pollCommitAiStatus(); }, 2000);
}
async function initCommitAi() {
aiSettings = loadAiSettings();
try {
localModelOptions = await commitAiLocalModels();
} catch { /* AI features stay disabled if this fails; not fatal to the app */ }
if (aiSettings.provider === "local") {
try { await commitAiLoad(aiSettings.localModelId); } catch { /* surfaced via status polling */ }
}
startCommitAiPolling();
}
function saveAiSettings(next: AiSettings) {
const modelChanged = next.provider === "local" && next.localModelId !== aiSettings.localModelId;
aiSettings = next;
persistAiSettings(next);
aiSettingsOpen = false;
if (next.provider === "local" && (modelChanged || commitAiPhase === "idle")) {
commitAiPhase = "idle";
void commitAiLoad(next.localModelId);
}
startCommitAiPolling();
}
function defaultAnalyticsSettings(): AnalyticsSettings {
@@ -1101,6 +1089,102 @@
}
}
function defaultCustomTheme(): CustomThemeColors {
return {
background: "#cfd5dc",
surface: "#e2e6ea",
accent: "#2eb5d1",
text: "#222328",
};
}
function isHexColor(value: unknown): value is string {
return typeof value === "string" && /^#[0-9a-f]{6}$/i.test(value);
}
function loadAppearancePreference(): AppAppearance {
try {
const stored = localStorage.getItem(APP_APPEARANCE_KEY);
if (stored === "modern" || stored === "classic" || stored === "custom") return stored;
} catch {
// Local storage is optional; the current design remains the default.
}
return "modern";
}
function loadCustomTheme(): CustomThemeColors {
const fallback = defaultCustomTheme();
try {
const stored = JSON.parse(localStorage.getItem(CUSTOM_THEME_KEY) ?? "null") as Partial<CustomThemeColors> | null;
if (!stored) return fallback;
return {
background: isHexColor(stored.background) ? stored.background : fallback.background,
surface: isHexColor(stored.surface) ? stored.surface : fallback.surface,
accent: isHexColor(stored.accent) ? stored.accent : fallback.accent,
text: isHexColor(stored.text) ? stored.text : fallback.text,
};
} catch {
return fallback;
}
}
function persistAppearancePreference(next: AppAppearance, colors: CustomThemeColors) {
try {
localStorage.setItem(APP_APPEARANCE_KEY, next);
localStorage.setItem(CUSTOM_THEME_KEY, JSON.stringify(colors));
} catch {
// Ignore storage quota/private-mode errors.
}
}
function applyAppearancePreference(next: AppAppearance, colors: CustomThemeColors) {
const root = document.documentElement;
root.dataset.appearance = next;
const customProperties = [
"--app-bg", "--app-button-bg", "--app-input-bg", "--app-dialog-bg", "--app-dialog-chrome",
"--app-dialog-backdrop", "--app-dialog-shadow", "--app-panel-shadow", "--app-settings-row-bg",
"--color-surface", "--color-surface-alt", "--color-surface-dim",
"--color-surface-hover", "--color-surface-raised", "--color-surface-solid", "--color-border",
"--color-border-subtle", "--color-border-input", "--color-primary", "--color-primary-dark",
"--color-accent", "--color-ink", "--color-ink-muted", "--color-ink-faint", "--color-ink-dim",
"--color-bar-text", "--color-bar-muted",
];
customProperties.forEach((property) => root.style.removeProperty(property));
if (next !== "custom") return;
const { background, surface, accent, text } = colors;
const values: Record<string, string> = {
"--app-bg": background,
"--app-button-bg": surface,
"--app-input-bg": `color-mix(in srgb, ${surface} 88%, white)`,
"--app-dialog-bg": surface,
"--app-dialog-chrome": `color-mix(in srgb, ${surface} 90%, ${background})`,
"--app-dialog-backdrop": `color-mix(in srgb, ${background} 72%, transparent)`,
"--app-dialog-shadow": `0 24px 68px color-mix(in srgb, ${text} 24%, transparent), 0 2px 12px color-mix(in srgb, ${text} 12%, transparent)`,
"--app-panel-shadow": `0 18px 48px color-mix(in srgb, ${text} 18%, transparent), inset 0 1px 0 color-mix(in srgb, ${surface} 88%, white)`,
"--app-settings-row-bg": `color-mix(in srgb, ${surface} 92%, ${background})`,
"--color-surface": surface,
"--color-surface-alt": `color-mix(in srgb, ${surface} 82%, ${background})`,
"--color-surface-dim": `color-mix(in srgb, ${surface} 88%, ${background})`,
"--color-surface-hover": `color-mix(in srgb, ${surface} 88%, ${text})`,
"--color-surface-raised": `color-mix(in srgb, ${surface} 92%, white)`,
"--color-surface-solid": surface,
"--color-border": `color-mix(in srgb, ${text} 32%, ${surface})`,
"--color-border-subtle": `color-mix(in srgb, ${text} 18%, ${surface})`,
"--color-border-input": `color-mix(in srgb, ${text} 38%, ${surface})`,
"--color-primary": accent,
"--color-primary-dark": `color-mix(in srgb, ${accent} 82%, black)`,
"--color-accent": accent,
"--color-ink": text,
"--color-ink-muted": `color-mix(in srgb, ${text} 76%, ${surface})`,
"--color-ink-faint": `color-mix(in srgb, ${text} 58%, ${surface})`,
"--color-ink-dim": `color-mix(in srgb, ${text} 68%, ${surface})`,
"--color-bar-text": text,
"--color-bar-muted": `color-mix(in srgb, ${text} 62%, ${surface})`,
};
Object.entries(values).forEach(([property, value]) => root.style.setProperty(property, value));
}
function loadLanguagePreference(): AppLanguage {
try {
const stored = localStorage.getItem(APP_LANGUAGE_KEY);
@@ -1139,48 +1223,68 @@
if (appTheme === "system") applyThemePreference(appTheme);
}
function saveAppSettings(next: AnalyticsSettings, nextTheme: AppTheme, nextLanguage: AppLanguage, nextAutoRefresh: boolean, nextExternalTools: ExternalToolsSettings) {
async function saveAppSettings(next: AnalyticsSettings, nextTheme: AppTheme, nextAppearance: AppAppearance, nextCustomTheme: CustomThemeColors, nextLanguage: AppLanguage, nextAutoRefresh: boolean, nextExternalTools: ExternalToolsSettings, nextIntegrations: GitIntegrationSettings, integrationSecrets: GitIntegrationSecretUpdate[]) {
const integrationsToSave = structuredClone(nextIntegrations);
try {
for (const update of integrationSecrets) {
const key = integrationCredentialKey(update.provider, update.accountId);
const azureOrganization = update.provider === "azure-devops" && update.accountId
? integrationsToSave.azureDevOpsOrganizations.find((organization) => organization.id === update.accountId)
: undefined;
const providerConfig = integrationsToSave.providers[update.provider];
if (update.removeToken) {
await credDelete(key);
if (azureOrganization) azureOrganization.tokenStored = false;
else providerConfig.tokenStored = false;
} else if (update.token) {
const fallbackUsername = update.provider === "github" ? "x-access-token" : "oauth2";
const username = (azureOrganization?.username ?? providerConfig.username).trim() || fallbackUsername;
await credSave(key, username, update.token, "token");
if (azureOrganization) azureOrganization.tokenStored = true;
else providerConfig.tokenStored = true;
}
}
} catch (error) {
errorMessage = appLanguage === "de"
? `Integration konnte nicht gespeichert werden: ${String(error)}`
: `Could not save integration: ${String(error)}`;
return;
}
const autoRefreshWasEnabled = autoRefreshEnabled;
analyticsSettings = next;
appTheme = nextTheme;
appAppearance = nextAppearance;
customTheme = nextCustomTheme;
appLanguage = nextLanguage;
autoRefreshEnabled = nextAutoRefresh;
externalToolsSettings = nextExternalTools;
gitIntegrationSettings = integrationsToSave;
persistAnalyticsSettings(next);
persistThemePreference(nextTheme);
persistAppearancePreference(nextAppearance, nextCustomTheme);
persistLanguagePreference(nextLanguage);
persistStoredBoolean(AUTO_REFRESH_ENABLED_KEY, nextAutoRefresh);
persistExternalToolsSettings(nextExternalTools);
persistGitIntegrationSettings(integrationsToSave);
externalToolsConfigured = true;
setTelemetryEnabled(next.enabled);
appSettingsOpen = false;
if (nextAutoRefresh && !autoRefreshWasEnabled) void autoRefreshTick();
if (next.enabled) trackEvent("settings_saved", { analytics_enabled: 1, theme: nextTheme, language: nextLanguage, auto_refresh: nextAutoRefresh ? 1 : 0 });
if (next.enabled) trackEvent("settings_saved", { analytics_enabled: 1, theme: nextTheme, appearance: nextAppearance, language: nextLanguage, auto_refresh: nextAutoRefresh ? 1 : 0 });
}
function updateCommitMessage(message: string) {
commitMessage = message;
if (message !== lastLocalAiGeneratedMessage) {
lastLocalAiGeneratedMessage = "";
}
}
async function generateCommitMessageWithAi() {
if (!activeRepoPath || commitAiGenerating) return;
if (aiSettings.provider === "local" && commitAiPhase !== "ready") return;
commitAiGenerating = true;
errorMessage = "";
try {
const notes = commitMessage.trim() || undefined;
if (aiSettings.provider === "local") {
const localNotes = notes && notes !== lastLocalAiGeneratedMessage ? notes : undefined;
commitMessage = await commitAiGenerate(activeRepoPath, {
provider: "local",
notes: localNotes,
localProfile: aiSettings.localProfile,
});
lastLocalAiGeneratedMessage = commitMessage;
} else if (aiSettings.provider === "openai") {
if (aiSettings.provider === "openai") {
const cred = await credLoad("ai:openai");
commitMessage = await commitAiGenerate(activeRepoPath, {
provider: "openai",
@@ -1188,7 +1292,6 @@
model: aiSettings.openaiModel,
apiKey: cred?.password,
});
lastLocalAiGeneratedMessage = "";
} else if (aiSettings.provider === "anthropic") {
const cred = await credLoad("ai:anthropic");
commitMessage = await commitAiGenerate(activeRepoPath, {
@@ -1197,7 +1300,6 @@
model: aiSettings.anthropicModel,
apiKey: cred?.password,
});
lastLocalAiGeneratedMessage = "";
} else {
const cred = await credLoad("ai:custom");
commitMessage = await commitAiGenerate(activeRepoPath, {
@@ -1207,7 +1309,6 @@
baseUrl: aiSettings.customBaseUrl,
apiKey: cred?.password,
});
lastLocalAiGeneratedMessage = "";
}
} catch (error) {
errorMessage = errorToMessage(error);
@@ -1218,10 +1319,6 @@
async function reviewStagedWithAi() {
if (!activeRepoPath || commitAiReviewing || stagedCount === 0) return;
if (aiSettings.provider === "local") {
errorMessage = "Pre-commit review currently requires OpenAI, Anthropic, or a custom endpoint.";
return;
}
commitAiReviewing = true;
errorMessage = "";
try {
@@ -1263,10 +1360,6 @@
async function splitStagedWithAi() {
if (!activeRepoPath || commitAiSplitting || stagedCount < 2) return;
if (aiSettings.provider === "local") {
errorMessage = "Commit splitting currently requires OpenAI, Anthropic, or a custom endpoint.";
return;
}
commitAiSplitting = true;
errorMessage = "";
try {
@@ -1571,8 +1664,6 @@
function defaultAiSettings(): AiSettings {
return {
provider: "openai",
localModelId: "qwen2.5-0.5b",
localProfile: "fast",
openaiModel: "gpt-4o-mini",
anthropicModel: "claude-3-5-haiku-latest",
customBaseUrl: "",
@@ -1584,11 +1675,17 @@
try {
const stored = JSON.parse(localStorage.getItem(AI_SETTINGS_KEY) ?? "null") as unknown;
if (stored && typeof stored === "object") {
const merged = { ...defaultAiSettings(), ...(stored as Partial<AiSettings>) };
// Local AI is still in development and disabled in the settings UI — migrate any
// previously saved selection away from it so nobody gets stuck on a dead option.
if (merged.provider === "local") merged.provider = "openai";
return merged;
const candidate = stored as Partial<AiSettings> & { provider?: unknown };
const provider = candidate.provider === "anthropic" || candidate.provider === "custom"
? candidate.provider
: "openai";
return {
provider,
openaiModel: typeof candidate.openaiModel === "string" ? candidate.openaiModel : "gpt-4o-mini",
anthropicModel: typeof candidate.anthropicModel === "string" ? candidate.anthropicModel : "claude-3-5-haiku-latest",
customBaseUrl: typeof candidate.customBaseUrl === "string" ? candidate.customBaseUrl : "",
customModel: typeof candidate.customModel === "string" ? candidate.customModel : "",
};
}
} catch {
// Fall through to defaults below.
@@ -2060,11 +2157,14 @@
function isNonFastForwardPushError(message: string): boolean {
const value = message.toLowerCase();
return value.includes("non-fast-forward")
|| value.includes("failed to push some refs")
|| value.includes("tip of your current branch is behind")
|| value.includes("fetch first");
}
function isUnrelatedHistoriesError(message: string): boolean {
return message.toLowerCase().includes("refusing to merge unrelated histories");
}
function statusHasConflicts(value: GitStatus | null): boolean {
return (value?.files ?? []).some((file) => file.staged === "conflicted" || file.unstaged === "conflicted");
}
@@ -2406,6 +2506,7 @@
activeView = "repository";
cloneDialogOpen = false;
pendingClone = null;
errorMessage = bundle.warning ?? "";
if (credDialogAction === "clone") {
credDialogOpen = false;
credDialogAction = null;
@@ -2416,6 +2517,7 @@
trackEvent("repository_cloned", {
changed_files: bundle.status.files.length,
has_upstream: bundle.status.upstream ? 1 : 0,
lfs_warning: bundle.warning ? 1 : 0,
});
} catch (error) {
const rawMessage = errorToMessage(error);
@@ -2453,6 +2555,11 @@
trackEvent("clone_dialog_opened");
}
function cloneFromDialog(remoteUrl: string, parentPath: string, directoryName: string, provider?: GitIntegrationProvider, accountId?: string) {
const credentialKey = provider ? integrationCredentialKey(provider, accountId) : undefined;
void cloneRepo(remoteUrl, parentPath, directoryName, undefined, undefined, credentialKey, false, provider ? "token" : "credentials");
}
function openRepoManagement() {
if (isBusy) return;
activeView = "management";
@@ -3547,17 +3654,61 @@
mode: CredentialMode,
) {
errorMessage = "";
await runOperation("Pulling", async () => {
applyStatus(await pull(activeRepoPath, username, password, pullStrategy, selectedRemote || undefined));
await refreshRepositoryViews(activeRepoPath);
const pulled = await pullWithUnrelatedHistoryConfirmation(username, password, "Pulling");
if (pulled) {
trackEvent("repository_pulled", {
from_stored_credential: fromStore ? 1 : 0,
changed_files: status?.files.length ?? 0,
});
});
}
handleRemoteResult("pull", key, fromStore, username, mode);
}
async function pullWithUnrelatedHistoryConfirmation(
username: string,
password: string,
label: string,
): Promise<boolean> {
await runOperation(label, async () => {
applyStatus(await pull(activeRepoPath, username, password, pullStrategy, selectedRemote || undefined));
await refreshRepositoryViews(activeRepoPath);
});
if (!errorMessage || !isUnrelatedHistoriesError(errorMessage)) return !errorMessage;
if (pullStrategy !== "merge") {
errorMessage = appLanguage === "de"
? "Lokales und entferntes Repository haben unabhängige Historien. Wähle in den Sync-Einstellungen die Merge-Strategie, um sie zusammenzuführen."
: "The local and remote repositories have unrelated histories. Choose the Merge strategy in Sync settings to combine them.";
return false;
}
errorMessage = "";
const confirmed = window.confirm(appLanguage === "de"
? "Das lokale und das entfernte Repository besitzen getrennte Commit-Historien.\n\nTrotzdem zusammenführen? Dabei können Merge-Konflikte entstehen."
: "The local and remote repositories have separate commit histories.\n\nMerge them anyway? This may produce merge conflicts.");
if (!confirmed) {
errorMessage = appLanguage === "de"
? "Pull abgebrochen: Die getrennten Historien wurden nicht verändert."
: "Pull cancelled: the separate histories were left unchanged.";
return false;
}
await runOperation(appLanguage === "de" ? "Historien zusammenführen" : "Merging histories", async () => {
applyStatus(await pull(
activeRepoPath,
username,
password,
pullStrategy,
selectedRemote || undefined,
undefined,
true,
));
await refreshRepositoryViews(activeRepoPath);
});
return !errorMessage;
}
async function doActualFetch(
username: string,
password: string,
@@ -3612,10 +3763,7 @@
if (!fromStore) credDialogError = "";
await runOperation("Pulling before push", async () => {
applyStatus(await pull(activeRepoPath, username, password, pullStrategy, selectedRemote || undefined));
await refreshRepositoryViews(activeRepoPath);
});
await pullWithUnrelatedHistoryConfirmation(username, password, "Pulling before push");
if (errorMessage) {
handleRemoteResult("pull", key, fromStore, username, mode);
@@ -3947,6 +4095,25 @@
});
}
async function ignoreStatusTarget(target: string, kind: GitIgnoreKind) {
if (!activeRepoPath || !target) return;
const description = kind === "folder" ? "folder" : kind === "extension" ? "file extension" : "file";
await runOperation(`Ignoring ${description}`, async () => {
applyStatus(await addToGitignore(activeRepoPath, target, kind));
await refreshExplorerFiles(activeRepoPath);
trackEvent("gitignore_rule_added", { kind });
});
}
async function stopTrackingTarget(target: string, kind: "file" | "folder") {
if (!activeRepoPath || !target) return;
await runOperation(`Stopping tracking for ${kind}`, async () => {
applyStatus(await untrackPaths(activeRepoPath, [target]));
await refreshExplorerFiles(activeRepoPath);
trackEvent("git_paths_untracked", { kind });
});
}
function discardFiles(files: GitFileStatus[], staged: boolean) {
if (!activeRepoPath || isBusy || files.length === 0) return;
pendingDiscard = { kind: "file", files, staged };
@@ -4196,7 +4363,6 @@
commitMessage = "";
amendMode = false;
preAmendDraftMessage = "";
lastLocalAiGeneratedMessage = "";
await refreshRepositoryViews(activeRepoPath);
trackEvent("commit_created", { amend: 1 });
});
@@ -4207,7 +4373,6 @@
await runOperation("Committing", async () => {
applyStatus(await commit(activeRepoPath, message));
commitMessage = "";
lastLocalAiGeneratedMessage = "";
await refreshRepositoryViews(activeRepoPath);
trackEvent("commit_created", { amend: 0, staged_files: trackedStagedCount });
});
@@ -4443,6 +4608,22 @@
}
}
function loadGitIntegrationSettings(): GitIntegrationSettings {
try {
return normaliseGitIntegrationSettings(JSON.parse(localStorage.getItem(GIT_INTEGRATIONS_SETTINGS_KEY) ?? "null"));
} catch {
return defaultGitIntegrationSettings();
}
}
function persistGitIntegrationSettings(next: GitIntegrationSettings) {
try {
localStorage.setItem(GIT_INTEGRATIONS_SETTINGS_KEY, JSON.stringify(next));
} catch {
// Metadata persistence is best-effort; tokens remain in the OS keychain.
}
}
function hasStoredExternalToolsSettings(): boolean {
try {
return localStorage.getItem(EXTERNAL_TOOLS_SETTINGS_KEY) != null;
@@ -5309,6 +5490,8 @@
onExternalDiff={compareExplorerFileExternally}
onFileHistory={openFileHistoryDialog}
onBlame={openBlame}
onIgnore={ignoreStatusTarget}
onStopTracking={stopTrackingTarget}
collapsed={explorerPanelCollapsed}
onToggleCollapsed={toggleExplorerPanelCollapsed}
/>
@@ -5378,6 +5561,8 @@
onDiscard={discardFiles}
onDiscardMany={discardChanges}
onStash={stashStatusFiles}
onIgnore={ignoreStatusTarget}
onStopTracking={stopTrackingTarget}
onPatch={openPreferredFileDiff}
onStageAll={stageAllFiles}
onUnstageAll={unstageAllFiles}
@@ -5408,8 +5593,6 @@
{isBusy}
{operation}
{stagedCount}
commitAiProvider={aiSettings.provider}
{commitAiPhase}
{commitAiGenerating}
{commitAiReviewing}
{commitAiSplitting}
@@ -5557,9 +5740,12 @@
<AppSettingsDialog
analytics={analyticsSettings}
theme={appTheme}
appearance={appAppearance}
customTheme={customTheme}
language={appLanguage}
autoRefresh={autoRefreshEnabled}
externalTools={externalToolsSettings}
integrations={gitIntegrationSettings}
detectedTools={detectedExternalTools}
detectionPending={externalToolsDetectionPending}
detectionUnavailable={externalToolsDetectionUnavailable}
@@ -5771,7 +5957,6 @@
{#await import("./lib/components/AiSettingsDialog.svelte") then module}
<module.default
settings={aiSettings}
localModels={localModelOptions}
onSave={saveAiSettings}
onClose={() => { aiSettingsOpen = false; }}
/>
@@ -5893,7 +6078,9 @@
<CloneRepositoryDialog
isBusy={operation === "Cloning repository"}
error={cloneDialogError}
onClone={cloneRepo}
language={appLanguage}
integrations={gitIntegrationSettings}
onClone={cloneFromDialog}
onClose={() => { if (!isBusy) cloneDialogOpen = false; }}
/>
{/if}
+1351 -179
View File
File diff suppressed because it is too large Load Diff
+3 -4
View File
@@ -1,5 +1,5 @@
<script lang="ts">
import { BookOpen, Database, Plus, X } from "@lucide/svelte";
import { Folder, GitBranch, Plus, X } from "@lucide/svelte";
interface RepositoryTabItem {
path: string;
@@ -28,8 +28,7 @@
disabled={isBusy}
title={language === "de" ? "Repository-Verwaltung" : "Repository Management"}
>
<BookOpen size={14} aria-hidden="true" />
<span>{language === "de" ? "Repository-Verwaltung" : "Repository Management"}</span>
<Folder size={15} aria-hidden="true" />
</button>
<div class="repo-tabs-scroll">
@@ -47,7 +46,7 @@
disabled={isBusy}
title={repo.path}
>
<Database size={15} aria-hidden="true" />
<GitBranch size={13} aria-hidden="true" />
<span>{repo.name}</span>
</button>
<button
+1 -2
View File
@@ -15,8 +15,7 @@
function providerLabel(value: CommitAiProvider): string {
if (value === "openai") return "OpenAI";
if (value === "anthropic") return "Anthropic";
if (value === "custom") return "Custom endpoint";
return "Local AI";
return "Custom endpoint";
}
function locationLabel(finding: AiReviewFinding): string {
+6 -76
View File
@@ -1,20 +1,18 @@
<script lang="ts">
import { onDestroy, onMount } from "svelte";
import { AlertCircle, Bot, Check, Cpu, Eye, EyeOff, Gauge, Globe, Key, LoaderCircle, Sparkles, X, Zap } from "@lucide/svelte";
import { Bot, Check, Eye, EyeOff, Globe, Key, LoaderCircle, X } from "@lucide/svelte";
import { credDelete, credLoad, credSave } from "../git";
import type { AiSettings, CommitAiLocalProfile, CommitAiProvider, LocalModelOption } from "../types";
import SelectMenu from "./SelectMenu.svelte";
import type { AiSettings, CommitAiProvider } from "../types";
interface Props {
settings: AiSettings;
localModels: LocalModelOption[];
onSave: (settings: AiSettings) => void;
onClose: () => void;
}
let { settings, localModels = [], onSave, onClose }: Props = $props();
let { settings, onSave, onClose }: Props = $props();
type CloudProvider = Exclude<CommitAiProvider, "local">;
type CloudProvider = CommitAiProvider;
const CRED_KEYS: Record<CloudProvider, string> = {
openai: "ai:openai",
@@ -22,9 +20,7 @@
custom: "ai:custom",
};
let provider = $state<CommitAiProvider>("local");
let localModelId = $state("");
let localProfile = $state<CommitAiLocalProfile>("fast");
let provider = $state<CommitAiProvider>("openai");
let openaiModel = $state("");
let anthropicModel = $state("");
let customBaseUrl = $state("");
@@ -41,8 +37,6 @@
$effect(() => {
provider = settings.provider;
localModelId = settings.localModelId;
localProfile = settings.localProfile ?? "fast";
openaiModel = settings.openaiModel;
anthropicModel = settings.anthropicModel;
customBaseUrl = settings.customBaseUrl;
@@ -103,8 +97,6 @@
]);
onSave({
provider,
localModelId,
localProfile,
openaiModel: openaiModel.trim() || "gpt-4o-mini",
anthropicModel: anthropicModel.trim() || "claude-3-5-haiku-latest",
customBaseUrl: customBaseUrl.trim(),
@@ -117,26 +109,6 @@
}
}
function formatSize(mb: number): string {
return mb >= 1000 ? `${(mb / 1000).toFixed(1)} GB` : `${mb} MB`;
}
function recommendedModelForProfile(profile: CommitAiLocalProfile): string {
if (profile === "balanced") return "qwen2.5-1.5b";
if (profile === "detailed") return "qwen2.5-3b";
return "qwen2.5-0.5b";
}
function selectLocalProfile(profile: CommitAiLocalProfile) {
const previousRecommended = recommendedModelForProfile(localProfile);
localProfile = profile;
const nextRecommended = recommendedModelForProfile(profile);
if (!localModelId || localModelId === previousRecommended) {
localModelId = nextRecommended;
}
}
let selectedLocalModel = $derived(localModels.find((option) => option.id === localModelId));
</script>
<div
@@ -156,17 +128,6 @@
<form class="ai-settings-form" onsubmit={(e) => { e.preventDefault(); void handleSave(); }}>
<div class="ai-provider-options" role="radiogroup" aria-label="AI provider">
<button
type="button"
class="ai-provider-option ai-provider-option-local"
class:active={provider === "local"}
disabled
title="Local AI is still in development and not yet available"
>
<Cpu size={16} aria-hidden="true" />
Local AI
<span class="ai-provider-badge">In development</span>
</button>
<button type="button" class="ai-provider-option" class:active={provider === "openai"} onclick={() => { provider = "openai"; }}>
<Bot size={16} aria-hidden="true" />
OpenAI
@@ -181,38 +142,7 @@
</button>
</div>
{#if provider === "local"}
<div class="cred-field">
<span class="cred-field-label">Local speed</span>
<div class="ai-local-profile-options" role="radiogroup" aria-label="Local AI speed">
<button type="button" class="ai-local-profile-option" class:active={localProfile === "fast"} onclick={() => selectLocalProfile("fast")}>
<Zap size={15} aria-hidden="true" />
Fast
</button>
<button type="button" class="ai-local-profile-option" class:active={localProfile === "balanced"} onclick={() => selectLocalProfile("balanced")}>
<Gauge size={15} aria-hidden="true" />
Balanced
</button>
<button type="button" class="ai-local-profile-option" class:active={localProfile === "detailed"} onclick={() => selectLocalProfile("detailed")}>
<Sparkles size={15} aria-hidden="true" />
Detailed
</button>
</div>
</div>
<label class="cred-field">
<span class="cred-field-label">Model</span>
<SelectMenu value={localModelId} options={localModels.map((option) => ({ value: option.id, label: `${option.label} - ${formatSize(option.approx_size_mb)}` }))} onChange={(value) => { localModelId = value; }} />
</label>
<div class="cred-token-hint">
<AlertCircle size={13} aria-hidden="true" />
<span>
Switching downloads the model{selectedLocalModel ? ` (${formatSize(selectedLocalModel.approx_size_mb)})` : ""}
in the background — depending on your internet connection this can take several minutes.
After that it stays cached locally and loads instantly on the next start.
The speed setting only changes Local AI; API providers keep their existing prompt.
</span>
</div>
{:else if provider === "openai"}
{#if provider === "openai"}
<label class="cred-field">
<span class="cred-field-label">Model</span>
<input type="text" bind:value={openaiModel} placeholder="gpt-4o-mini" autocomplete="off" spellcheck="false" />
+155 -11
View File
@@ -6,11 +6,13 @@
ChevronDown,
ChevronRight,
CircleDashed,
CloudCog,
Code2,
FolderOpen,
GitCompare,
GitMerge,
Languages,
KeyRound,
Palette,
RefreshCw,
RotateCw,
@@ -29,38 +31,50 @@
type ExternalToolKind,
type ExternalToolPreset,
} from "../externalTools";
import { configuredIntegrationCount, defaultGitIntegrationSettings } from "../integrations";
import type {
AnalyticsSettings,
AppAppearance,
AppLanguage,
AppTheme,
CustomThemeColors,
DetectedExternalTool,
ExternalToolsSettings,
GitIntegrationSecretUpdate,
GitIntegrationSettings,
ToolOpenMode,
} from "../types";
import IntegrationSettingsPage from "./IntegrationSettingsPage.svelte";
import SelectMenu from "./SelectMenu.svelte";
type SettingsPage = "general" | "tools";
type SettingsPage = "general" | "integrations" | "tools";
interface Props {
analytics: AnalyticsSettings;
theme: AppTheme;
appearance: AppAppearance;
customTheme: CustomThemeColors;
language: AppLanguage;
autoRefresh: boolean;
externalTools: ExternalToolsSettings;
integrations: GitIntegrationSettings;
detectedTools: DetectedExternalTool[];
detectionPending: boolean;
detectionUnavailable: boolean;
onRefreshDetectedTools: () => void | Promise<void>;
onSave: (settings: AnalyticsSettings, theme: AppTheme, language: AppLanguage, autoRefresh: boolean, externalTools: ExternalToolsSettings) => void;
onSave: (settings: AnalyticsSettings, theme: AppTheme, appearance: AppAppearance, customTheme: CustomThemeColors, language: AppLanguage, autoRefresh: boolean, externalTools: ExternalToolsSettings, integrations: GitIntegrationSettings, integrationSecrets: GitIntegrationSecretUpdate[]) => void | Promise<void>;
onClose: () => void;
}
let {
analytics,
theme = "system",
appearance = "modern",
customTheme = { background: "#cfd5dc", surface: "#e2e6ea", accent: "#2eb5d1", text: "#222328" },
language = "en",
autoRefresh = true,
externalTools,
integrations,
detectedTools = [],
detectionPending = false,
detectionUnavailable = false,
@@ -71,30 +85,83 @@
const toolKinds: ExternalToolKind[] = ["editor", "diff", "merge", "terminal", "fileManager"];
let activePage = $state<SettingsPage>("tools");
let activePage = $state<SettingsPage>("integrations");
let activeToolKind = $state<ExternalToolKind>("editor");
let advancedOpen = $state(false);
let analyticsEnabled = $state(true);
let selectedTheme = $state<AppTheme>("system");
let selectedAppearance = $state<AppAppearance>("modern");
let customColors = $state<CustomThemeColors>({ background: "#cfd5dc", surface: "#e2e6ea", accent: "#2eb5d1", text: "#222328" });
let selectedLanguage = $state<AppLanguage>("en");
let autoRefreshEnabled = $state(true);
let tools = $state<ExternalToolsSettings>(defaultExternalToolsSettings());
let integrationDraft = $state<GitIntegrationSettings>(defaultGitIntegrationSettings());
let integrationSecretUpdates = $state<GitIntegrationSecretUpdate[]>([]);
let saving = $state(false);
const isGerman = $derived(selectedLanguage === "de");
$effect(() => {
analyticsEnabled = analytics.enabled;
selectedTheme = theme;
selectedAppearance = appearance;
customColors = structuredClone(customTheme);
selectedLanguage = language;
autoRefreshEnabled = autoRefresh;
tools = structuredClone(externalTools);
integrationDraft = structuredClone(integrations);
});
function save() {
onSave({
async function save() {
if (saving) return;
saving = true;
try {
await onSave({
...analytics,
enabled: analyticsEnabled,
noticeSeen: true,
}, selectedTheme, selectedLanguage, autoRefreshEnabled, $state.snapshot(tools));
}, selectedTheme, selectedAppearance, $state.snapshot(customColors), selectedLanguage, autoRefreshEnabled, $state.snapshot(tools), $state.snapshot(integrationDraft), $state.snapshot(integrationSecretUpdates));
} finally {
saving = false;
}
}
function resetCustomColors() {
customColors = selectedTheme === "dark"
? { background: "#222328", surface: "#2b2e34", accent: "#2eb5d1", text: "#f0f1f2" }
: { background: "#cfd5dc", surface: "#e2e6ea", accent: "#2eb5d1", text: "#222328" };
}
function cssColorToHex(value: string, fallback: string): string {
const color = value.trim();
if (/^#[0-9a-f]{6}$/i.test(color)) return color.toLowerCase();
if (!color || typeof document === "undefined") return fallback;
const probe = document.createElement("span");
probe.style.color = color;
if (!probe.style.color) return fallback;
probe.style.display = "none";
document.body.appendChild(probe);
const match = getComputedStyle(probe).color.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)/i);
probe.remove();
if (!match) return fallback;
return `#${match.slice(1, 4).map((part) => Number(part).toString(16).padStart(2, "0")).join("")}`;
}
function currentThemeColors(): CustomThemeColors {
const styles = getComputedStyle(document.documentElement);
const fallback = selectedTheme === "dark"
? { background: "#222328", surface: "#2b2e34", accent: "#2eb5d1", text: "#f0f1f2" }
: { background: "#cfd5dc", surface: "#e2e6ea", accent: "#2eb5d1", text: "#222328" };
return {
background: cssColorToHex(styles.getPropertyValue("--app-bg"), fallback.background),
surface: cssColorToHex(styles.getPropertyValue("--color-surface"), fallback.surface),
accent: cssColorToHex(styles.getPropertyValue("--color-accent"), fallback.accent),
text: cssColorToHex(styles.getPropertyValue("--color-ink"), fallback.text),
};
}
function selectAppearance(next: AppAppearance) {
if (next === "custom" && selectedAppearance !== "custom") customColors = currentThemeColors();
selectedAppearance = next;
}
function toolLabel(kind: ExternalToolKind): string {
@@ -266,10 +333,22 @@
</span>
{#if !detectionUnavailable}<em>{detectedTools.length}</em>{/if}
</button>
<button type="button" class:active={activePage === "integrations"} onclick={() => { activePage = "integrations"; }}>
<CloudCog size={16} aria-hidden="true" />
<span>
<strong>{isGerman ? "Integrationen" : "Integrations"}</strong>
<small>GitHub, GitLab, Azure DevOps & Gitea</small>
</span>
<em>{configuredIntegrationCount(integrationDraft)}</em>
</button>
<div class="settings-nav-note">
<ShieldCheck size={15} aria-hidden="true" />
<p>{isGerman ? "Tool-Argumente werden direkt und ohne zusätzliche Shell übergeben." : "Tool arguments are passed directly without an extra shell."}</p>
{#if activePage === "integrations"}<KeyRound size={15} aria-hidden="true" />{:else}<ShieldCheck size={15} aria-hidden="true" />{/if}
<p>
{activePage === "integrations"
? (isGerman ? "Tokens werden sicher im Schlüsselbund des Betriebssystems gespeichert." : "Tokens are stored securely in the operating system keychain.")
: (isGerman ? "Tool-Argumente werden direkt und ohne zusätzliche Shell übergeben." : "Tool arguments are passed directly without an extra shell.")}
</p>
</div>
</nav>
@@ -292,6 +371,40 @@
</div>
</section>
<section class="general-setting-panel">
<header><SlidersHorizontal size={16} /><div><h4>{isGerman ? "Darstellungsstil" : "Design style"}</h4><p>{isGerman ? "Aktuell, klassisch oder selbst gestaltet." : "Current, classic, or designed by you."}</p></div></header>
<div class="settings-segmented" role="radiogroup" aria-label={isGerman ? "Darstellungsstil" : "Design style"}>
<label class:active={selectedAppearance === "modern"}><input type="radio" name="appearance" value="modern" checked={selectedAppearance === "modern"} onchange={() => selectAppearance("modern")} /><span>{isGerman ? "Aktuell" : "Modern"}</span></label>
<label class:active={selectedAppearance === "classic"}><input type="radio" name="appearance" value="classic" checked={selectedAppearance === "classic"} onchange={() => selectAppearance("classic")} /><span>{isGerman ? "Klassisch" : "Classic"}</span></label>
<label class:active={selectedAppearance === "custom"}><input type="radio" name="appearance" value="custom" checked={selectedAppearance === "custom"} onchange={() => selectAppearance("custom")} /><span>{isGerman ? "Eigene" : "Custom"}</span></label>
</div>
</section>
{#if selectedAppearance === "custom"}
<section class="general-setting-panel general-setting-wide custom-theme-panel">
<header>
<Palette size={16} />
<div><h4>{isGerman ? "Theme-Generator" : "Theme generator"}</h4><p>{isGerman ? "Erstelle dein eigenes Farbprofil." : "Create your own color profile."}</p></div>
<button class="theme-reset-button" type="button" onclick={resetCustomColors}><RotateCw size={13} />{isGerman ? "Zurücksetzen" : "Reset"}</button>
</header>
<div
class="theme-preview"
style={`--preview-bg:${customColors.background};--preview-surface:${customColors.surface};--preview-accent:${customColors.accent};--preview-text:${customColors.text};`}
aria-label={isGerman ? "Vorschau des eigenen Themes" : "Custom theme preview"}
>
<span class="theme-preview-sidebar"></span>
<span class="theme-preview-content"><i></i><b></b><em></em></span>
</div>
<div class="theme-color-grid">
<label><span>{isGerman ? "Hintergrund" : "Background"}</span><input type="color" bind:value={customColors.background} aria-label={isGerman ? "Hintergrundfarbe" : "Background color"} /><code>{customColors.background}</code></label>
<label><span>{isGerman ? "Fläche" : "Surface"}</span><input type="color" bind:value={customColors.surface} aria-label={isGerman ? "Flächenfarbe" : "Surface color"} /><code>{customColors.surface}</code></label>
<label><span>{isGerman ? "Akzent" : "Accent"}</span><input type="color" bind:value={customColors.accent} aria-label={isGerman ? "Akzentfarbe" : "Accent color"} /><code>{customColors.accent}</code></label>
<label><span>{isGerman ? "Schrift" : "Text"}</span><input type="color" bind:value={customColors.text} aria-label={isGerman ? "Schriftfarbe" : "Text color"} /><code>{customColors.text}</code></label>
</div>
<p class="theme-generator-note">{isGerman ? "Die Farben werden beim Speichern auf die gesamte Oberfläche angewendet." : "The colors are applied across the interface when you save."}</p>
</section>
{/if}
<section class="general-setting-panel">
<header><Languages size={16} /><div><h4>{isGerman ? "Sprache" : "Language"}</h4><p>{isGerman ? "Sprache der Oberfläche." : "Language used by the interface."}</p></div></header>
<div class="settings-segmented settings-language" role="radiogroup" aria-label={isGerman ? "App-Sprache" : "App language"}>
@@ -316,7 +429,7 @@
</label>
</section>
</div>
{:else}
{:else if activePage === "tools"}
<div class="settings-page-head tools-page-head">
<div>
<h3>{isGerman ? "Externe Tools" : "External tools"}</h3>
@@ -435,6 +548,19 @@
</div>
{/if}
</section>
{:else}
<div class="settings-page-head">
<div>
<h3>{isGerman ? "Integrationen" : "Integrations"}</h3>
<p>{isGerman ? "Verbinde Gitty mit deinen Git-Hosting-Diensten." : "Connect Gitty to your Git hosting services."}</p>
</div>
</div>
<IntegrationSettingsPage
language={selectedLanguage}
settings={integrationDraft}
onChange={(next) => { integrationDraft = next; }}
onSecretsChange={(updates) => { integrationSecretUpdates = updates; }}
/>
{/if}
</div>
</div>
@@ -443,7 +569,7 @@
<span>{isGerman ? "Änderungen werden erst beim Speichern übernommen." : "Changes are applied only after saving."}</span>
<div>
<button class="btn-secondary" type="button" onclick={onClose}>{isGerman ? "Abbrechen" : "Cancel"}</button>
<button class="btn-primary" type="submit"><Check size={16} aria-hidden="true" />{isGerman ? "Änderungen speichern" : "Save changes"}</button>
<button class="btn-primary" type="submit" disabled={saving}><Check size={16} aria-hidden="true" />{saving ? (isGerman ? "Wird gespeichert…" : "Saving…") : (isGerman ? "Änderungen speichern" : "Save changes")}</button>
</div>
</footer>
</form>
@@ -534,6 +660,22 @@
.settings-segmented label { display: flex; align-items: center; justify-content: center; min-height: 31px; border: 1px solid transparent; border-radius: 6px; color: var(--color-ink-dim); font-size: 10.5px; font-weight: 750; }
.settings-segmented label.active { border-color: var(--color-border-input); color: var(--color-ink); background: var(--color-surface-hover); }
.settings-segmented input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.custom-theme-panel > header { align-items: center; }
.custom-theme-panel > header > div { min-width: 0; }
.theme-reset-button { display: inline-flex; align-items: center; gap: 5px; min-height: 27px; margin-left: auto; padding: 0 8px; border: 1px solid var(--color-border); color: var(--color-ink-muted); background: var(--color-surface-raised); font-size: 9.5px; font-weight: 750; }
.theme-reset-button:hover:not(:disabled) { border-color: var(--color-border-input); color: var(--color-ink); background: var(--color-surface-hover); }
.theme-preview { display: grid; grid-template-columns: 28% 1fr; min-height: 78px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--preview-text) 30%, var(--preview-surface)); background: var(--preview-bg); }
.theme-preview-sidebar { border-right: 1px solid color-mix(in srgb, var(--preview-text) 24%, var(--preview-surface)); background: color-mix(in srgb, var(--preview-surface) 86%, var(--preview-bg)); }
.theme-preview-content { display: grid; grid-template-columns: 1fr auto; align-content: start; gap: 8px; margin: 10px; padding: 10px; border: 1px solid color-mix(in srgb, var(--preview-text) 22%, var(--preview-surface)); color: var(--preview-text); background: var(--preview-surface); }
.theme-preview-content i { display: block; width: 54%; height: 7px; background: var(--preview-text); opacity: .82; }
.theme-preview-content b { display: block; width: 34px; height: 18px; grid-row: 1 / 3; grid-column: 2; background: var(--preview-accent); }
.theme-preview-content em { display: block; width: 76%; height: 5px; background: var(--preview-text); opacity: .32; }
.theme-color-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.theme-color-grid label { display: grid; grid-template-columns: minmax(0, 1fr) 32px auto; align-items: center; gap: 8px; min-width: 0; min-height: 38px; padding: 5px 7px; border: 1px solid var(--color-border-subtle); background: var(--color-surface-raised); }
.theme-color-grid label > span { color: var(--color-ink-muted); font-size: 10px; font-weight: 750; }
.theme-color-grid input[type="color"] { width: 32px; height: 25px; padding: 2px; border: 1px solid var(--color-border-input); background: transparent; cursor: pointer; }
.theme-color-grid code { color: var(--color-ink-faint); font: 9px var(--font-mono); text-transform: uppercase; }
.theme-generator-note { margin: -5px 0 0 !important; color: var(--color-ink-faint) !important; }
.settings-switch-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; }
.settings-switch-row span { display: grid; gap: 3px; }
.settings-switch-row strong { color: var(--color-ink); font-size: 11px; }
@@ -564,11 +706,13 @@
.app-settings-head { min-height: 58px; padding: 10px 12px; }
.app-settings-mark { width: 34px; height: 34px; }
.settings-nav button small, .settings-nav button em { display: none; }
.settings-nav > button { grid-template-columns: auto minmax(0, 1fr); }
.settings-nav > button { grid-template-columns: auto minmax(0, 1fr); gap: 5px; padding-inline: 6px; }
.settings-nav button strong { font-size: 10px; }
.settings-page-head { align-items: stretch; flex-direction: column; }
.tool-rescan-button { align-self: flex-start; }
.general-settings-grid { grid-template-columns: 1fr; }
.general-setting-panel.general-setting-wide { grid-column: auto; }
.theme-color-grid { grid-template-columns: 1fr; }
.tool-config-panel { padding: 13px; }
.tool-usage-callout { grid-template-columns: 1fr; gap: 4px; }
}
+403 -103
View File
@@ -1,22 +1,24 @@
<script lang="ts">
import { onDestroy } from "svelte";
import { onDestroy, onMount } from "svelte";
import { open as openDialog } from "@tauri-apps/plugin-dialog";
import { Download, FolderOpen, LoaderCircle, X } from "@lucide/svelte";
import { Cloud, Download, FolderOpen, GitBranch, Globe2, LoaderCircle, LockKeyhole, RefreshCw, Search, X } from "@lucide/svelte";
import { listIntegrationRepositories } from "../git";
import { configuredIntegrationSources } from "../integrations";
import type { AppLanguage, GitIntegrationProvider, GitIntegrationRepository, GitIntegrationSettings, GitIntegrationSource } from "../types";
type CloneSource = "url" | "integrations";
interface Props {
isBusy: boolean;
error: string;
onClone: (remoteUrl: string, parentPath: string, directoryName: string) => void;
language: AppLanguage;
integrations: GitIntegrationSettings;
onClone: (remoteUrl: string, parentPath: string, directoryName: string, provider?: GitIntegrationProvider, accountId?: string) => void;
onClose: () => void;
}
let {
isBusy = false,
error = "",
onClone = () => {},
onClose = () => {},
}: Props = $props();
let { isBusy = false, error = "", language = "en", integrations, onClone = () => {}, onClose = () => {} }: Props = $props();
let source = $state<CloneSource>("url");
let remoteUrl = $state("");
let parentPath = $state("");
let directoryName = $state("");
@@ -25,29 +27,152 @@
let browseError = $state("");
let visibleError = $state("");
let errorHideTimer: ReturnType<typeof setTimeout> | undefined;
let selectedSourceId = $state("");
let selectedRepositoryId = $state("");
let repositorySearch = $state("");
let repositoriesBySource = $state<Record<string, GitIntegrationRepository[]>>({});
let loadingSourceId = $state("");
let repositoryError = $state("");
let repositoryListElement = $state<HTMLDivElement>();
let repositoryScrollbarElement = $state<HTMLDivElement>();
let repositoryScrollbarVisible = $state(false);
let repositoryScrollbarTop = $state(0);
let repositoryScrollbarHeight = $state(28);
let repositoryScrollTop = $state(0);
let repositoryScrollMax = $state(0);
let repositoryScrollbarPointerId = $state<number>();
let repositoryScrollbarDragY = 0;
let repositoryScrollbarDragScrollTop = 0;
let repositoryScrollbarFrame: number | undefined;
let repositoryRequestId = 0;
let directorySuggestion = $derived(directoryNameFromRemoteUrl(remoteUrl));
let canSubmit = $derived(
!isBusy &&
remoteUrl.trim().length > 0 &&
parentPath.trim().length > 0,
);
const isGerman = $derived(language === "de");
const configuredSources = $derived(configuredIntegrationSources(integrations));
const activeSource = $derived(configuredSources.find((candidate) => candidate.id === selectedSourceId));
const activeRepositories = $derived(activeSource ? repositoriesBySource[activeSource.id] ?? [] : []);
const filteredRepositories = $derived.by(() => {
const query = repositorySearch.trim().toLocaleLowerCase();
if (!query) return activeRepositories;
return activeRepositories.filter((repository) => `${repository.fullName} ${repository.description}`.toLocaleLowerCase().includes(query));
});
const azureRepositoryGroups = $derived.by(() => {
if (activeSource?.provider !== "azure-devops") return [];
const groups = new Map<string, GitIntegrationRepository[]>();
for (const repository of filteredRepositories) {
const separator = repository.fullName.indexOf("/");
const project = separator > 0 ? repository.fullName.slice(0, separator) : (isGerman ? "Weitere Repositories" : "Other repositories");
const repositories = groups.get(project) ?? [];
repositories.push(repository);
groups.set(project, repositories);
}
return [...groups.entries()].map(([project, repositories]) => ({ project, repositories }));
});
const selectedRepository = $derived(activeRepositories.find((repository) => repository.id === selectedRepositoryId));
const directorySuggestion = $derived(directoryNameFromRemoteUrl(remoteUrl));
const canSubmit = $derived(!isBusy && remoteUrl.trim().length > 0 && parentPath.trim().length > 0);
$effect(() => {
const nextError = error || browseError;
if (errorHideTimer) clearTimeout(errorHideTimer);
visibleError = nextError;
if (nextError) {
errorHideTimer = setTimeout(() => {
visibleError = "";
}, 6000);
}
if (nextError) errorHideTimer = setTimeout(() => { visibleError = ""; }, 6000);
});
$effect(() => {
filteredRepositories.length;
loadingSourceId;
repositoryError;
scheduleRepositoryScrollbarUpdate();
});
onMount(() => {
window.addEventListener("resize", scheduleRepositoryScrollbarUpdate);
return () => window.removeEventListener("resize", scheduleRepositoryScrollbarUpdate);
});
onDestroy(() => {
if (errorHideTimer) clearTimeout(errorHideTimer);
if (repositoryScrollbarFrame !== undefined) cancelAnimationFrame(repositoryScrollbarFrame);
});
function scheduleRepositoryScrollbarUpdate() {
if (repositoryScrollbarFrame !== undefined) cancelAnimationFrame(repositoryScrollbarFrame);
repositoryScrollbarFrame = requestAnimationFrame(() => {
repositoryScrollbarFrame = undefined;
updateRepositoryScrollbar();
});
}
function updateRepositoryScrollbar() {
const list = repositoryListElement;
const track = repositoryScrollbarElement;
if (!list || !track) {
repositoryScrollbarVisible = false;
return;
}
const scrollMax = Math.max(0, list.scrollHeight - list.clientHeight);
const trackHeight = track.clientHeight;
const thumbHeight = scrollMax > 0
? Math.max(28, trackHeight * (list.clientHeight / list.scrollHeight))
: trackHeight;
const thumbTravel = Math.max(0, trackHeight - thumbHeight);
repositoryScrollTop = list.scrollTop;
repositoryScrollMax = scrollMax;
repositoryScrollbarHeight = thumbHeight;
repositoryScrollbarTop = scrollMax > 0 ? (list.scrollTop / scrollMax) * thumbTravel : 0;
repositoryScrollbarVisible = scrollMax > 1;
}
function startRepositoryScrollbarDrag(event: PointerEvent) {
if (!repositoryListElement) return;
event.preventDefault();
event.stopPropagation();
repositoryScrollbarPointerId = event.pointerId;
repositoryScrollbarDragY = event.clientY;
repositoryScrollbarDragScrollTop = repositoryListElement.scrollTop;
(event.currentTarget as HTMLElement).setPointerCapture(event.pointerId);
}
function dragRepositoryScrollbar(event: PointerEvent) {
if (repositoryScrollbarPointerId !== event.pointerId || !repositoryListElement || !repositoryScrollbarElement) return;
const thumbTravel = repositoryScrollbarElement.clientHeight - repositoryScrollbarHeight;
if (thumbTravel <= 0) return;
repositoryListElement.scrollTop = repositoryScrollbarDragScrollTop
+ ((event.clientY - repositoryScrollbarDragY) / thumbTravel) * repositoryScrollMax;
}
function stopRepositoryScrollbarDrag(event: PointerEvent) {
if (repositoryScrollbarPointerId !== event.pointerId) return;
repositoryScrollbarPointerId = undefined;
const target = event.currentTarget as HTMLElement;
if (target.hasPointerCapture(event.pointerId)) target.releasePointerCapture(event.pointerId);
}
function jumpRepositoryScrollbar(event: MouseEvent) {
if (event.target !== event.currentTarget || !repositoryListElement || !repositoryScrollbarElement) return;
const track = repositoryScrollbarElement.getBoundingClientRect();
const thumbTravel = track.height - repositoryScrollbarHeight;
if (thumbTravel <= 0) return;
const targetTop = Math.max(0, Math.min(thumbTravel, event.clientY - track.top - repositoryScrollbarHeight / 2));
repositoryListElement.scrollTop = (targetTop / thumbTravel) * repositoryScrollMax;
}
function handleRepositoryScrollbarKey(event: KeyboardEvent) {
if (!repositoryListElement) return;
const page = repositoryListElement.clientHeight * 0.85;
const changes: Record<string, number> = {
ArrowUp: repositoryListElement.scrollTop - 40,
ArrowDown: repositoryListElement.scrollTop + 40,
PageUp: repositoryListElement.scrollTop - page,
PageDown: repositoryListElement.scrollTop + page,
Home: 0,
End: repositoryScrollMax,
};
if (!(event.key in changes)) return;
event.preventDefault();
repositoryListElement.scrollTop = changes[event.key];
}
function directoryNameFromRemoteUrl(url: string): string {
const trimmed = url.trim().split(/[?#]/, 1)[0]?.replace(/[\\/]+$/g, "") ?? "";
const lastSegment = trimmed.split(/[\\/:]/).filter(Boolean).pop() ?? "";
@@ -64,112 +189,287 @@
if (isBusy) return;
browseError = "";
try {
const selected = await openDialog({
title: "Select clone destination",
directory: true,
multiple: false,
defaultPath: parentPath.trim() || undefined,
});
if (typeof selected !== "string") return;
parentPath = selected;
} catch (error) {
browseError = errorToMessage(error);
}
const selected = await openDialog({ title: isGerman ? "Zielordner zum Klonen auswählen" : "Select clone destination", directory: true, multiple: false, defaultPath: parentPath.trim() || undefined });
if (typeof selected === "string") parentPath = selected;
} catch (error) { browseError = errorToMessage(error); }
}
function handleRemoteInput(event: Event) {
const nextRemoteUrl = (event.currentTarget as HTMLInputElement).value;
function setRemoteUrl(nextRemoteUrl: string) {
remoteUrl = nextRemoteUrl;
if (directoryNameEdited) return;
directoryAutoName = directoryNameFromRemoteUrl(nextRemoteUrl);
directoryName = directoryAutoName;
}
function handleRemoteInput(event: Event) {
setRemoteUrl((event.currentTarget as HTMLInputElement).value);
selectedRepositoryId = "";
}
function handleDirectoryInput(event: Event) {
const nextDirectoryName = (event.currentTarget as HTMLInputElement).value;
directoryNameEdited = nextDirectoryName.trim().length > 0 && nextDirectoryName !== directoryAutoName;
}
function submit(event: SubmitEvent) {
event.preventDefault();
if (!canSubmit) return;
onClone(remoteUrl.trim(), parentPath.trim(), directoryName.trim());
function selectRepository(repository: GitIntegrationRepository) {
selectedRepositoryId = repository.id;
setRemoteUrl(repository.cloneUrl);
}
function sortRepositories(repositories: GitIntegrationRepository[]): GitIntegrationRepository[] {
return [...repositories].sort((left, right) => left.fullName.localeCompare(
right.fullName,
isGerman ? "de" : "en",
{ numeric: true, sensitivity: "base" },
));
}
async function loadRepositories(integrationSource: GitIntegrationSource, force = false) {
selectedSourceId = integrationSource.id;
selectedRepositoryId = "";
repositorySearch = "";
repositoryError = "";
if (!force && repositoriesBySource[integrationSource.id]) return;
const requestId = ++repositoryRequestId;
loadingSourceId = integrationSource.id;
try {
const repositories = await listIntegrationRepositories(integrationSource.provider, integrationSource.baseUrl, integrationSource.accountId);
if (requestId === repositoryRequestId) repositoriesBySource = { ...repositoriesBySource, [integrationSource.id]: sortRepositories(repositories) };
} catch (error) {
if (requestId === repositoryRequestId) repositoryError = errorToMessage(error);
} finally {
if (requestId === repositoryRequestId) loadingSourceId = "";
}
}
function selectIntegrationSource(integrationSource: GitIntegrationSource) {
source = "integrations";
void loadRepositories(integrationSource);
}
function showUrlInput() {
source = "url";
selectedRepositoryId = "";
}
function formatUpdatedAt(value: string): string {
if (!value) return "";
const date = new Date(value);
return Number.isNaN(date.getTime()) ? "" : new Intl.DateTimeFormat(isGerman ? "de-DE" : "en-US", { dateStyle: "medium" }).format(date);
}
function submit(event: SubmitEvent) {
event.preventDefault();
if (canSubmit) onClone(remoteUrl.trim(), parentPath.trim(), directoryName.trim(), source === "integrations" ? activeSource?.provider : undefined, source === "integrations" ? activeSource?.accountId : undefined);
}
</script>
<div class="dialog-backdrop" role="presentation">
<div class="dialog clone-repository-dialog" role="dialog" aria-modal="true" aria-label="Clone repository" tabindex="-1">
<header class="dialog-header">
<div>
<span class="eyebrow">Repository Management</span>
<h2 class="mt-0.5 text-ink text-base font-bold leading-tight">Clone repository</h2>
</div>
<button class="dialog-close" type="button" onclick={onClose} disabled={isBusy} title="Close">
<X size={18} aria-hidden="true" />
</button>
<div class="dialog clone-repository-dialog" role="dialog" aria-modal="true" aria-label={isGerman ? "Repository klonen" : "Clone repository"} tabindex="-1">
<header class="dialog-header clone-dialog-header">
<div><h2>{isGerman ? "Repository klonen" : "Clone a Repository"}</h2></div>
<button class="dialog-close" type="button" onclick={onClose} disabled={isBusy} title={isGerman ? "Schließen" : "Close"} aria-label={isGerman ? "Klonen schließen" : "Close clone dialog"}><X size={18} /></button>
</header>
<form class="clone-dialog-form" onsubmit={submit}>
<label class="clone-dialog-field">
<span>Remote URL</span>
<div class="clone-dialog-layout">
<aside class="clone-source-nav" aria-label={isGerman ? "Repository-Quellen" : "Repository sources"}>
<div class="clone-source-heading">{isGerman ? "Quelle" : "Source"}</div>
<div class="clone-source-list" role="tablist" aria-label={isGerman ? "Repository-Quelle" : "Repository source"}>
<button type="button" role="tab" aria-selected={source === "url"} class:active={source === "url"} onclick={showUrlInput}><Globe2 size={15} /><span>{isGerman ? "Mit URL klonen" : "Clone with URL"}</span></button>
{#each configuredSources as integrationSource}
<button type="button" role="tab" aria-selected={source === "integrations" && selectedSourceId === integrationSource.id} class:active={source === "integrations" && selectedSourceId === integrationSource.id} onclick={() => selectIntegrationSource(integrationSource)}>
{#if integrationSource.provider === "azure-devops"}<Cloud size={15} />{:else}<GitBranch size={15} />{/if}
<span>{integrationSource.provider === "azure-devops" ? `Azure · ${integrationSource.label}` : integrationSource.label}</span>
</button>
{/each}
</div>
{#if configuredSources.length === 0}<p>{isGerman ? "Integrationen kannst du in den Einstellungen einrichten." : "Set up integrations in Settings."}</p>{/if}
</aside>
<section class="clone-dialog-content">
<div class="clone-dialog-title">
<span>{source === "integrations" ? (activeSource?.label ?? "Integration") : "URL"}</span>
<h3>{isGerman ? "Repository klonen" : "Clone a Repo"}</h3>
</div>
<div class="clone-target-grid">
<label class="clone-dialog-field"><span>{isGerman ? "Klonen nach" : "Where to clone to"}</span><div class="clone-dialog-path-field"><input bind:value={parentPath} autocomplete="off" spellcheck="false" placeholder={isGerman ? "Übergeordneten Ordner auswählen" : "Choose parent folder"} disabled={isBusy} /><button class="btn-secondary" type="button" onclick={chooseParentFolder} disabled={isBusy}><FolderOpen size={14} />{isGerman ? "Durchsuchen" : "Browse"}</button></div></label>
<label class="clone-dialog-field"><span>{isGerman ? "Ordnername" : "Folder name"}</span><input bind:value={directoryName} oninput={handleDirectoryInput} autocomplete="off" spellcheck="false" placeholder={directorySuggestion || "Optional"} disabled={isBusy} /></label>
</div>
{#if source === "url"}
<label class="clone-dialog-field clone-url-field">
<span>{isGerman ? "Repository-URL" : "Repository URL"}</span>
<!-- svelte-ignore a11y_autofocus -->
<input
bind:value={remoteUrl}
oninput={handleRemoteInput}
autocomplete="off"
spellcheck="false"
placeholder="https://github.com/org/project.git"
disabled={isBusy}
autofocus
/>
<input value={remoteUrl} oninput={handleRemoteInput} autocomplete="off" spellcheck="false" placeholder="https://gitlab.com/org/project.git" disabled={isBusy} autofocus />
</label>
<label class="clone-dialog-field">
<span>Destination</span>
<div class="clone-dialog-path-field">
<input
bind:value={parentPath}
autocomplete="off"
spellcheck="false"
placeholder="Choose parent folder"
disabled={isBusy}
/>
<button class="btn-secondary" type="button" onclick={chooseParentFolder} disabled={isBusy}>
<FolderOpen size={14} aria-hidden="true" />
Browse
</button>
</div>
</label>
<label class="clone-dialog-field">
<span>Folder name</span>
<input
bind:value={directoryName}
oninput={handleDirectoryInput}
autocomplete="off"
spellcheck="false"
placeholder={directorySuggestion || "Optional"}
disabled={isBusy}
/>
</label>
{#if visibleError}
<div class="clone-dialog-error" role="alert">{visibleError}</div>
{/if}
<div class="clone-dialog-actions">
<button class="btn-secondary" type="button" onclick={onClose} disabled={isBusy}>
Cancel
</button>
<button class="btn-primary" type="submit" disabled={!canSubmit}>
{#if isBusy}
<LoaderCircle class="spin" size={16} aria-hidden="true" />
{:else}
<Download size={16} aria-hidden="true" />
{/if}
Clone
</button>
<section class="integration-browser" aria-label={isGerman ? "Repositories aus Integrationen" : "Repositories from integrations"}>
{#if configuredSources.length === 0}
<div class="integration-empty"><Cloud size={26} /><strong>{isGerman ? "Keine aktive Integration" : "No active integration"}</strong><p>{isGerman ? "Richte unter Einstellungen → Integrationen zuerst GitHub, GitLab, Azure DevOps oder Gitea ein." : "Set up GitHub, GitLab, Azure DevOps, or Gitea under Settings → Integrations first."}</p></div>
{:else}
<div class="repository-toolbar">
<label><Search size={14} /><input bind:value={repositorySearch} placeholder={isGerman ? "Repositories durchsuchen…" : "Search repositories…"} aria-label={isGerman ? "Repositories durchsuchen" : "Search repositories"} /></label>
<button type="button" onclick={() => activeSource && loadRepositories(activeSource, true)} disabled={!activeSource || loadingSourceId.length > 0} title={isGerman ? "Neu laden" : "Refresh"} aria-label={isGerman ? "Repository-Liste neu laden" : "Refresh repository list"}><RefreshCw class={loadingSourceId ? "spin" : ""} size={14} /></button>
</div>
<div class="repository-list-shell">
<div id="integration-repository-list" class="repository-list" bind:this={repositoryListElement} onscroll={updateRepositoryScrollbar} aria-live="polite">
{#if loadingSourceId}
<div class="repository-state"><LoaderCircle class="spin" size={20} /><span>{isGerman ? "Repositories werden geladen…" : "Loading repositories…"}</span></div>
{:else if repositoryError}
<div class="repository-state repository-state-error"><strong>{isGerman ? "Repositories konnten nicht geladen werden" : "Could not load repositories"}</strong><span>{repositoryError}</span></div>
{:else if filteredRepositories.length === 0}
<div class="repository-state"><GitBranch size={20} /><span>{repositorySearch ? (isGerman ? "Keine passenden Repositories." : "No matching repositories.") : (isGerman ? "Keine Repositories gefunden." : "No repositories found.")}</span></div>
{:else if activeSource?.provider === "azure-devops"}
{#each azureRepositoryGroups as group (group.project)}
<section class="repository-project-group" aria-label={group.project}>
<div class="repository-project-header"><span>{group.project}</span><em>{group.repositories.length}</em></div>
{#each group.repositories as repository (repository.id)}
<button type="button" class="repository-option" class:selected={selectedRepositoryId === repository.id} onclick={() => selectRepository(repository)}>
<span class="repository-option-icon"><GitBranch size={15} /></span>
<span class="repository-option-copy"><strong>{repository.name}</strong><small>{repository.description || repository.cloneUrl}</small></span>
<span class="repository-option-meta">{#if repository.private}<LockKeyhole size={12} aria-label={isGerman ? "Privat" : "Private"} />{/if}{formatUpdatedAt(repository.updatedAt)}</span>
</button>
{/each}
</section>
{/each}
{:else}
{#each filteredRepositories as repository (repository.id)}
<button type="button" class="repository-option" class:selected={selectedRepositoryId === repository.id} onclick={() => selectRepository(repository)}>
<span class="repository-option-icon"><GitBranch size={16} /></span>
<span class="repository-option-copy"><strong>{repository.fullName}</strong><small>{repository.description || repository.cloneUrl}</small></span>
<span class="repository-option-meta">{#if repository.private}<LockKeyhole size={12} aria-label={isGerman ? "Privat" : "Private"} />{/if}{formatUpdatedAt(repository.updatedAt)}</span>
</button>
{/each}
{/if}
</div>
<div
class="repository-scrollbar"
class:visible={repositoryScrollbarVisible}
class:dragging={repositoryScrollbarPointerId !== undefined}
bind:this={repositoryScrollbarElement}
role="scrollbar"
tabindex={repositoryScrollbarVisible ? 0 : -1}
aria-controls="integration-repository-list"
aria-label={isGerman ? "Repository-Liste scrollen" : "Scroll repository list"}
aria-orientation="vertical"
aria-valuemin="0"
aria-valuemax={repositoryScrollMax}
aria-valuenow={repositoryScrollTop}
onclick={jumpRepositoryScrollbar}
onkeydown={handleRepositoryScrollbarKey}
>
<div
class="repository-scrollbar-thumb"
role="presentation"
style={`height:${repositoryScrollbarHeight}px;transform:translateY(${repositoryScrollbarTop}px)`}
onpointerdown={startRepositoryScrollbarDrag}
onpointermove={dragRepositoryScrollbar}
onpointerup={stopRepositoryScrollbarDrag}
onpointercancel={stopRepositoryScrollbarDrag}
></div>
</div>
</div>
{#if selectedRepository}<div class="selected-repository"><span>{isGerman ? "Ausgewählt" : "Selected"}</span><strong>{selectedRepository.fullName}</strong><code>{selectedRepository.cloneUrl}</code></div>{/if}
{/if}
</section>
{/if}
{#if visibleError}<div class="clone-dialog-error" role="alert">{visibleError}</div>{/if}
</section>
</div>
<div class="clone-dialog-actions"><button class="btn-secondary" type="button" onclick={onClose} disabled={isBusy}>{isGerman ? "Abbrechen" : "Cancel"}</button><button class="btn-primary" type="submit" disabled={!canSubmit}>{#if isBusy}<LoaderCircle class="spin" size={16} />{:else}<Download size={16} />{/if}{isGerman ? "Klonen" : "Clone"}</button></div>
</form>
</div>
</div>
<style>
.clone-repository-dialog { width: min(900px, calc(100vw - 32px)); height: min(660px, calc(100vh - 32px)); }
.clone-dialog-header { min-height: 52px; padding: 0 16px 0 20px; }
.clone-dialog-header h2 { margin: 0; color: var(--color-ink); font-size: 15px; font-weight: 650; }
.clone-dialog-form { grid-template-rows: minmax(0, 1fr) auto; gap: 0; height: calc(100% - 53px); padding: 0; }
.clone-dialog-layout { display: grid; grid-template-columns: 205px minmax(0, 1fr); min-height: 0; }
.clone-source-nav { min-width: 0; padding: 12px 0; border-right: 1px solid var(--color-border-subtle); background: var(--app-dialog-chrome); }
.clone-source-heading { padding: 2px 14px 8px; color: var(--color-ink-faint); font-size: 8.5px; font-weight: 850; text-transform: uppercase; letter-spacing: .08em; }
.clone-source-list { display: grid; gap: 2px; }
.clone-source-list button { display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: center; gap: 8px; width: 100%; min-height: 38px; padding: 0 14px; border: 0; border-radius: 0; color: var(--color-ink-dim); background: transparent; box-shadow: none; font-size: 10.5px; font-weight: 650; text-align: left; }
.clone-source-list button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clone-source-list button :global(svg) { color: var(--color-ink-faint); }
.clone-source-list button:hover { color: var(--color-ink); background: var(--color-surface-hover); }
.clone-source-list button.active { color: var(--color-ink); background: color-mix(in srgb, var(--color-accent) 18%, var(--color-surface-hover)); box-shadow: inset 3px 0 0 var(--color-accent); }
.clone-source-list button.active :global(svg) { color: var(--color-accent); }
.clone-source-nav > p { margin: 12px 14px 0; color: var(--color-ink-faint); font-size: 9px; line-height: 1.45; }
.clone-dialog-content { display: grid; grid-template-rows: auto auto minmax(0, 1fr); grid-auto-rows: auto; align-content: stretch; gap: 14px; min-width: 0; min-height: 0; padding: 16px 18px; overflow: hidden; }
.clone-dialog-title { display: grid; gap: 3px; }
.clone-dialog-title > span { color: var(--color-accent); font-size: 8.5px; font-weight: 850; text-transform: uppercase; letter-spacing: .07em; }
.clone-dialog-title h3 { margin: 0; color: var(--color-ink); font-size: 16px; font-weight: 650; }
.clone-url-field { align-self: start; margin-top: 2px; }
.integration-browser { display: grid; grid-template-rows: auto minmax(0, 1fr); grid-auto-rows: auto; gap: 8px; min-height: 0; }
.repository-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) 32px; gap: 6px; }
.repository-toolbar label { position: relative; min-width: 0; }
.repository-toolbar label > :global(svg) { position: absolute; z-index: 1; top: 10px; left: 10px; color: var(--color-ink-faint); }
.repository-toolbar input { height: 34px; padding-left: 31px; font-size: 11px; }
.repository-toolbar button { min-height: 32px; padding: 0; }
.repository-list-shell { position: relative; min-height: 0; height: 100%; overflow: hidden; border: 1px solid var(--color-border-input); border-radius: 7px; background: var(--color-surface-raised); box-shadow: 0 8px 18px rgba(0,0,0,.13); }
.repository-list { min-height: 0; height: 100%; padding-right: 8px; overflow: auto; scrollbar-width: none; border-radius: inherit; background: transparent; }
.repository-list::-webkit-scrollbar { display: none; width: 0; height: 0; }
.repository-scrollbar { position: absolute; z-index: 2; top: 3px; right: 1px; bottom: 3px; width: 7px; border-radius: 4px; opacity: 0; pointer-events: none; touch-action: none; transition: opacity 120ms ease; }
.repository-scrollbar.visible { opacity: 1; pointer-events: auto; }
.repository-scrollbar-thumb { position: absolute; top: 0; right: 2px; width: 3px; min-height: 28px; border-radius: 3px; background: var(--app-scrollbar-thumb); cursor: pointer; transition: width 100ms ease, background 100ms ease; }
.repository-scrollbar:hover .repository-scrollbar-thumb,
.repository-scrollbar:focus-visible .repository-scrollbar-thumb,
.repository-scrollbar.dragging .repository-scrollbar-thumb { right: 1px; width: 4px; background: var(--app-scrollbar-thumb-hover); }
.repository-scrollbar:focus-visible { outline: 1px solid color-mix(in srgb, var(--color-accent) 70%, transparent); outline-offset: 1px; }
.repository-project-group + .repository-project-group { border-top: 1px solid var(--color-border-subtle); }
.repository-project-header { position: sticky; z-index: 1; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 34px; padding: 7px 10px 6px 12px; color: var(--color-accent); background: color-mix(in srgb, var(--color-surface-raised) 96%, transparent); font-size: 9.5px; font-weight: 900; text-transform: uppercase; letter-spacing: .045em; }
.repository-project-header span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.repository-project-header em { display: grid; flex: 0 0 auto; place-items: center; min-width: 19px; height: 16px; padding: 0 5px; color: var(--color-ink); background: color-mix(in srgb, var(--color-ink) 12%, transparent); font-size: 8px; font-style: normal; line-height: 1; letter-spacing: 0; }
.repository-option { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 6px 10px 6px 12px; border: 0; border-bottom: 1px solid var(--color-border-subtle); border-radius: 0; color: var(--color-ink-dim); background: transparent; text-align: left; }
.repository-option:last-child { border-bottom: 0; }
.repository-option:hover { color: var(--color-ink); background: var(--color-surface-hover); }
.repository-option.selected { color: var(--color-ink); background: color-mix(in srgb, var(--color-accent) 15%, var(--color-surface-hover)); box-shadow: inset 3px 0 0 var(--color-accent); }
.repository-option-icon { display: grid; place-items: center; width: 22px; height: 22px; color: var(--color-ink-faint); }
.repository-option.selected .repository-option-icon { color: var(--color-accent); }
.repository-option-copy { display: grid; min-width: 0; gap: 3px; }
.repository-option-copy strong, .repository-option-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.repository-option-copy strong { color: inherit; font-size: 10.5px; }
.repository-option-copy small { color: var(--color-ink-faint); font-size: 9px; }
.repository-project-group .repository-option { min-height: 38px; padding-block: 5px; }
.repository-project-group .repository-option-copy { gap: 0; }
.repository-project-group .repository-option-copy strong { color: var(--color-ink); font-size: 11.5px; font-weight: 800; }
.repository-project-group .repository-option-copy small { display: none; }
.repository-option-meta { display: flex; align-items: center; gap: 5px; color: var(--color-ink-faint); font-size: 8.5px; }
.repository-state, .integration-empty { display: grid; place-items: center; align-content: center; min-height: 188px; padding: 20px; color: var(--color-ink-faint); text-align: center; }
.repository-state { gap: 7px; font-size: 10.5px; }
.repository-state strong, .integration-empty strong { color: var(--color-ink); font-size: 11px; }
.repository-state-error strong { color: #e86060; }
.repository-state-error span { max-width: 520px; line-height: 1.45; }
.integration-empty { min-height: 260px; gap: 8px; }
.integration-empty :global(svg) { color: var(--color-accent); }
.integration-empty p { max-width: 400px; margin: 0; color: var(--color-ink-faint); font-size: 10px; line-height: 1.5; }
.selected-repository { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 3px 8px; min-width: 0; padding: 8px 9px; border-left: 2px solid var(--color-accent); background: color-mix(in srgb, var(--color-accent) 6%, transparent); }
.selected-repository span { color: var(--color-accent); font-size: 8.5px; font-weight: 850; text-transform: uppercase; letter-spacing: .04em; }
.selected-repository strong { overflow: hidden; color: var(--color-ink); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.selected-repository code { grid-column: 2; overflow: hidden; color: var(--color-ink-faint); font: 8.5px var(--font-mono); text-overflow: ellipsis; white-space: nowrap; }
.clone-target-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(150px, .72fr); gap: 10px; }
.clone-dialog-actions { min-height: 54px; align-items: center; padding: 9px 16px; border-top: 1px solid var(--color-border-subtle); background: var(--app-dialog-chrome); }
@media (max-width: 700px) {
.clone-repository-dialog { width: min(660px, calc(100vw - 20px)); }
.clone-dialog-layout { grid-template-columns: 155px minmax(0, 1fr); }
.clone-source-list button { padding-inline: 10px; }
.clone-target-grid { grid-template-columns: 1fr; }
.repository-option-meta { display: none; }
}
@media (max-width: 500px) {
.dialog-backdrop { padding: 10px; }
.clone-repository-dialog { width: calc(100vw - 20px); height: min(660px, calc(100vh - 20px)); }
.clone-dialog-layout { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
.clone-source-nav { padding: 6px 0; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--color-border-subtle); }
.clone-source-heading, .clone-source-nav > p { display: none; }
.clone-source-list { display: flex; width: max-content; min-width: 100%; padding: 0 6px; }
.clone-source-list button { width: auto; min-height: 34px; padding-inline: 9px; border-radius: 5px; }
.clone-source-list button.active { box-shadow: inset 0 -2px 0 var(--color-accent); }
.clone-dialog-content { padding: 13px 12px; overflow: hidden; }
}
</style>
+7 -16
View File
@@ -1,6 +1,5 @@
<script lang="ts">
import { Check, GitCommitHorizontal, LoaderCircle, RotateCcw, Settings, ShieldCheck, Sparkles } from "@lucide/svelte";
import type { CommitAiPhase, CommitAiProvider } from "../types";
interface Props {
commitMessage: string;
@@ -10,8 +9,6 @@
isBusy: boolean;
operation: string;
stagedCount: number;
commitAiProvider: CommitAiProvider;
commitAiPhase: CommitAiPhase;
commitAiGenerating: boolean;
commitAiReviewing: boolean;
commitAiSplitting: boolean;
@@ -35,8 +32,6 @@
isBusy = false,
operation = "",
stagedCount = 0,
commitAiProvider = "local",
commitAiPhase = "idle",
commitAiGenerating = false,
commitAiReviewing = false,
commitAiSplitting = false,
@@ -57,23 +52,19 @@
onCommit();
}
function aiButtonTitle(provider: CommitAiProvider, phase: CommitAiPhase, staged: number): string {
function aiButtonTitle(staged: number): string {
if (staged === 0) return "Stage changes first";
if (provider === "local" && phase === "loading") return "AI model is downloading/loading — this happens once";
if (provider === "local" && phase === "error") return "AI model failed to load — check AI settings";
return "Generate commit message with AI from the staged diff";
}
let localModelLoading = $derived(commitAiProvider === "local" && commitAiPhase === "loading");
let canGenerate = $derived(
hasRepository &&
!isBusy &&
!commitAiGenerating &&
!commitAiReviewing &&
stagedCount > 0 &&
(commitAiProvider !== "local" || commitAiPhase === "ready"),
stagedCount > 0,
);
let canReview = $derived(canGenerate && commitAiProvider !== "local");
let canReview = $derived(canGenerate);
let canSplit = $derived(canReview && stagedCount > 1 && !commitAiSplitting);
</script>
@@ -90,7 +81,7 @@
type="button"
onclick={onSplitStaged}
disabled={!canSplit}
title={commitAiProvider === "local" ? "Commit splitting currently requires an API provider" : "Suggest logical commits for the staged files"}
title="Suggest logical commits for the staged files"
>
{#if commitAiSplitting}<LoaderCircle class="spin" size={14} aria-hidden="true" />{:else}<GitCommitHorizontal size={14} aria-hidden="true" />{/if}
Split
@@ -100,7 +91,7 @@
type="button"
onclick={onReviewStaged}
disabled={!canReview}
title={commitAiProvider === "local" ? "Pre-commit review currently requires an API provider" : stagedCount === 0 ? "Stage changes first" : "Review staged changes for bugs and risks"}
title={stagedCount === 0 ? "Stage changes first" : "Review staged changes for bugs and risks"}
>
{#if commitAiReviewing}<LoaderCircle class="spin" size={14} aria-hidden="true" />{:else}<ShieldCheck size={14} aria-hidden="true" />{/if}
Review
@@ -110,9 +101,9 @@
type="button"
onclick={onGenerateCommitMessage}
disabled={!canGenerate}
title={aiButtonTitle(commitAiProvider, commitAiPhase, stagedCount)}
title={aiButtonTitle(stagedCount)}
>
{#if commitAiGenerating || localModelLoading}<LoaderCircle class="spin" size={14} aria-hidden="true" />{:else}<Sparkles size={14} aria-hidden="true" />{/if}
{#if commitAiGenerating}<LoaderCircle class="spin" size={14} aria-hidden="true" />{:else}<Sparkles size={14} aria-hidden="true" />{/if}
Generate
</button>
<button class="commit-settings-button" type="button" onclick={onOpenAiSettings} disabled={isBusy} title="AI settings" aria-label="AI settings">
+83 -29
View File
@@ -11,20 +11,24 @@
FileCog,
FileImage,
FileJson,
FileMinus2,
FileSearch,
GitCompare,
FileSpreadsheet,
FileText,
FileType,
FileVideo,
FileX,
Folder,
FolderMinus,
FolderOpen,
FolderX,
ExternalLink,
History,
Terminal,
} from "@lucide/svelte";
import { languageIconForPath } from "../languageIcons";
import type { ExplorerNode, ExplorerNodeKind, FileStatusKind, GitRepositoryFile } from "../types";
import type { ExplorerNode, ExplorerNodeKind, FileStatusKind, GitIgnoreKind, GitRepositoryFile } from "../types";
import LanguageIcon from "./LanguageIcon.svelte";
interface Props {
@@ -46,6 +50,8 @@
onExternalDiff: (node: ExplorerNode) => void;
onFileHistory: (node: ExplorerNode) => void;
onBlame: (node: ExplorerNode) => void;
onIgnore: (target: string, kind: GitIgnoreKind) => void;
onStopTracking: (target: string, kind: "file" | "folder") => void;
collapsed?: boolean;
onToggleCollapsed?: () => void;
}
@@ -69,6 +75,8 @@
onExternalDiff = () => {},
onFileHistory = () => {},
onBlame = () => {},
onIgnore = () => {},
onStopTracking = () => {},
collapsed = false,
onToggleCollapsed = () => {},
}: Props = $props();
@@ -76,6 +84,7 @@
let contextNode = $state<ExplorerNode | null>(null);
let contextMenuX = $state(0);
let contextMenuY = $state(0);
let contextMenuElement = $state<HTMLDivElement | null>(null);
const isGerman = $derived(language === "de");
function mergeExplorerStatus(current: FileStatusKind | null, next: FileStatusKind | null): FileStatusKind | null {
@@ -183,14 +192,19 @@
return "text";
}
function openFileContextMenu(event: MouseEvent, node: ExplorerNode) {
if (node.kind !== "file") return;
function openNodeContextMenu(event: MouseEvent, node: ExplorerNode) {
event.preventDefault();
event.stopPropagation();
contextNode = node;
contextMenuX = Math.max(8, Math.min(event.clientX + 2, window.innerWidth - 192));
contextMenuY = Math.max(8, Math.min(event.clientY + 2, window.innerHeight - 220));
contextMenuX = Math.max(8, Math.min(event.clientX + 2, window.innerWidth - 248));
contextMenuY = Math.max(8, Math.min(event.clientY + 2, window.innerHeight - 320));
requestAnimationFrame(() => {
if (!contextMenuElement) return;
const bounds = contextMenuElement.getBoundingClientRect();
contextMenuX = Math.max(8, Math.min(event.clientX + 2, window.innerWidth - bounds.width - 8));
contextMenuY = Math.max(8, Math.min(event.clientY + 2, window.innerHeight - bounds.height - 8));
});
}
function closeFileContextMenu() {
@@ -232,6 +246,31 @@
onFileHistory(node);
}
function explorerFileNodes(node: ExplorerNode): ExplorerNode[] {
if (node.kind === "file") return [node];
return node.children.flatMap(explorerFileNodes);
}
function isIgnoreableExplorerFile(node: ExplorerNode): boolean {
return node.kind === "file" && !node.tracked && node.path.replace(/\\/g, "/").toLowerCase() !== ".gitignore";
}
function runContextIgnore(kind: GitIgnoreKind) {
const node = contextNode;
if (!node) return;
if (kind === "folder" && node.kind !== "folder") return;
if ((kind === "file" || kind === "extension") && node.kind !== "file") return;
closeFileContextMenu();
onIgnore(node.path, kind);
}
function runContextStopTracking() {
const node = contextNode;
if (!node) return;
closeFileContextMenu();
onStopTracking(node.path, node.kind);
}
function handleWindowKeydown(event: KeyboardEvent) {
if (event.key === "Escape") closeFileContextMenu();
}
@@ -239,6 +278,10 @@
let explorerTree = $derived(buildExplorerTree(repoFiles));
let visibleNodes = $derived(flattenExplorerTree(explorerTree, expandedExplorerPaths));
let hasFolders = $derived(explorerTree.some((node) => node.kind === "folder"));
let contextFiles = $derived(contextNode ? explorerFileNodes(contextNode) : []);
let contextCanIgnore = $derived(contextFiles.some(isIgnoreableExplorerFile));
let contextCanStopTracking = $derived(contextFiles.some((node) => node.tracked));
let contextIgnoreExtension = $derived(contextNode?.kind === "file" && contextCanIgnore ? extensionFor(contextNode.path) : "");
let selectedFileNode = $derived(
selectedExplorerKind === "file"
? visibleNodes.find((node) => node.kind === "file" && node.path === selectedExplorerPath) ?? null
@@ -338,7 +381,7 @@
class:folder={node.kind === "folder"}
style={`--depth: ${node.depth}`}
title={node.path}
oncontextmenu={(event) => openFileContextMenu(event, node)}
oncontextmenu={(event) => openNodeContextMenu(event, node)}
>
{#if node.kind === "folder"}
<button
@@ -420,12 +463,14 @@
{#if contextNode}
<div
bind:this={contextMenuElement}
class="explorer-context-menu"
style={`left: ${contextMenuX}px; top: ${contextMenuY}px;`}
role="menu"
tabindex="-1"
aria-label={`Actions for ${contextNode.path}`}
>
{#if contextNode.kind === "file"}
<button type="button" role="menuitem" onclick={openContextFileInEditor} disabled={contextNode.status === "deleted"}>
<FileCode size={14} aria-hidden="true" />
{isGerman ? `In ${editorName} öffnen` : `Open in ${editorName}`}
@@ -434,35 +479,44 @@
<GitCompare size={14} aria-hidden="true" />
{isGerman ? `Mit HEAD in ${diffName} vergleichen` : `Compare with HEAD in ${diffName}`}
</button>
<button
type="button"
role="menuitem"
onclick={openContextFileHistory}
disabled={!contextNode.tracked}
title={contextNode.tracked ? "Show the commit history for this file" : "File history is only available for tracked files"}
>
<button type="button" role="menuitem" onclick={openContextFileHistory} disabled={!contextNode.tracked} title={contextNode.tracked ? "Show the commit history for this file" : "File history is only available for tracked files"}>
<History size={14} aria-hidden="true" />
File history
{isGerman ? "Dateiverlauf" : "File history"}
</button>
<button
type="button"
role="menuitem"
onclick={openContextFile}
disabled={contextNode.status === "deleted"}
title={contextNode.status === "deleted" ? "Deleted files cannot be revealed in Explorer" : "Reveal this file in Explorer"}
>
<button type="button" role="menuitem" onclick={openContextFile} disabled={contextNode.status === "deleted"} title={contextNode.status === "deleted" ? "Deleted files cannot be revealed in Explorer" : "Reveal this file in Explorer"}>
<ExternalLink size={14} aria-hidden="true" />
Open in Explorer
{isGerman ? "Im Explorer öffnen" : "Open in Explorer"}
</button>
<button
type="button"
role="menuitem"
onclick={openContextBlame}
disabled={!contextNode.tracked || contextNode.status === "deleted"}
title={!contextNode.tracked || contextNode.status === "deleted" ? "Blame is only available for tracked files" : "Show blame for this file"}
>
<button type="button" role="menuitem" onclick={openContextBlame} disabled={!contextNode.tracked || contextNode.status === "deleted"} title={!contextNode.tracked || contextNode.status === "deleted" ? "Blame is only available for tracked files" : "Show blame for this file"}>
<FileSearch size={14} aria-hidden="true" />
Blame
</button>
{/if}
{#if contextCanStopTracking || contextCanIgnore}
<div class="menu-separator" role="separator"></div>
{/if}
{#if contextCanStopTracking}
<button class="untrack" type="button" role="menuitem" onclick={runContextStopTracking} disabled={isBusy} title="Keep the working-tree content and remove it from the Git index">
{#if contextNode.kind === "folder"}<FolderMinus size={14} aria-hidden="true" />{:else}<FileMinus2 size={14} aria-hidden="true" />{/if}
{isGerman ? `${contextNode.kind === "folder" ? "Ordner" : "Datei"} nicht mehr tracken` : `Stop tracking ${contextNode.kind}`}
</button>
{/if}
{#if contextCanIgnore && contextNode.kind === "file"}
<button class="ignore" type="button" role="menuitem" onclick={() => runContextIgnore("file")} disabled={isBusy} title={`Add /${contextNode.path.replace(/\\/g, "/")} to .gitignore`}>
<FileX size={14} aria-hidden="true" />
{isGerman ? "Datei ignorieren" : "Ignore file"}
</button>
{#if contextIgnoreExtension}
<button class="ignore" type="button" role="menuitem" onclick={() => runContextIgnore("extension")} disabled={isBusy} title={`Add *.${contextIgnoreExtension} to .gitignore`}>
<FileType size={14} aria-hidden="true" />
{isGerman ? `Alle *.${contextIgnoreExtension}-Dateien ignorieren` : `Ignore all *.${contextIgnoreExtension} files`}
</button>
{/if}
{:else if contextCanIgnore && contextNode.kind === "folder"}
<button class="ignore" type="button" role="menuitem" onclick={() => runContextIgnore("folder")} disabled={isBusy} title={`Add /${contextNode.path.replace(/\\/g, "/").replace(/\/+$/, "")}/ to .gitignore`}>
<FolderX size={14} aria-hidden="true" />
{isGerman ? "Ordner ignorieren" : "Ignore folder"}
</button>
{/if}
</div>
{/if}
+122 -9
View File
@@ -503,8 +503,9 @@
{
id: "lfs-sync",
title: "LFS-Objekte synchronisieren",
summary: "Ein normaler Pull in Gitty prüft nach erfolgreicher Git-Synchronisierung automatisch auf LFS und lädt benötigte Objekte mit demselben Remote und denselben Zugangsdaten. Ein zweiter Pull ist nicht nötig.",
summary: "Clone und Pull prüfen in Gitty automatisch auf LFS und laden benötigte Objekte mit demselben Remote und denselben Zugangsdaten. Ein zweiter Pull ist nicht nötig.",
steps: [
"Neue Klone aus der Oberfläche sowie über --clone aktivieren LFS lokal und laden die Objekte von origin, bevor das Repository geöffnet wird.",
"Normales Push nutzt den LFS-Pre-push-Hook und lädt neue LFS-Objekte vor den Git-Referenzen hoch.",
"Objekte laden im LFS-Dialog ist ein manueller Reparatur- oder Aktualisierungsschritt, falls lokale Inhalte fehlen.",
"Cache bereinigen entfernt sicher nicht mehr benötigte lokale Objekte; aktuell verwendete und noch nicht gepushte Inhalte bleiben erhalten.",
@@ -563,8 +564,9 @@
{
id: "lfs-sync",
title: "Synchronize LFS objects",
summary: "After a successful regular pull, Gitty automatically checks for LFS and downloads required objects with the same remote and credentials. A second pull is not necessary.",
summary: "Clone and pull automatically check for LFS in Gitty and download required objects with the same remote and credentials. A second pull is not necessary.",
steps: [
"Fresh clones from the UI and --clone activate LFS locally and download objects from origin before the repository is opened.",
"A normal push uses the LFS pre-push hook to upload new LFS objects before Git references are published.",
"Pull objects in the LFS dialog is a manual repair or refresh action when local content is missing.",
"Prune cache safely removes unused local objects while retaining current and unpushed content.",
@@ -633,6 +635,19 @@
"Öffne das Tab-Kontextmenü, um ein Repository aus der aktuellen Arbeitsfläche zu entfernen, ohne Dateien zu löschen.",
],
},
{
id: "app-integrations",
title: "Git-Hosting-Integrationen und Clone",
summary: "Gitty verbindet sich mit GitHub, GitLab.com, GitLab Self-Managed, Azure DevOps und Gitea. Danach kannst du deine verfügbaren Repositories direkt im Clone-Dialog durchsuchen und laden.",
steps: [
"Öffne Einstellungen → Integrationen, wähle einen Anbieter und trage Server-URL, Benutzername sowie einen Personal Access Token ein.",
"Für Azure DevOps kannst du mehrere Organisationen anlegen. Jede Organisation besitzt einen eigenen Anzeigenamen, eine Organisations-URL und einen separat gespeicherten Token.",
"Aktiviere die Integration und speichere die Einstellungen. Tokens werden getrennt von den App-Einstellungen im Schlüsselbund des Betriebssystems abgelegt.",
"Öffne Clone → Integrationen und wähle das gewünschte Konto. Gitty lädt alle zugänglichen Repositories und sortiert sie alphabetisch.",
"Filtere bei Bedarf nach Name oder Beschreibung, wähle ein Repository und einen Zielordner und starte den Clone direkt mit den gespeicherten Zugangsdaten.",
],
note: "Vergib Tokens nur die benötigten Leserechte und eine möglichst kurze Laufzeit. Entfernst du einen gespeicherten Token in Gitty, wird die betroffene Integration automatisch deaktiviert.",
},
{
id: "app-commit-detail",
title: "Saubere Commits in Gitty erstellen",
@@ -1095,6 +1110,19 @@
"Use the tab context menu to remove a repository from the workspace without deleting its files.",
],
},
{
id: "app-integrations",
title: "Git hosting integrations and Clone",
summary: "Gitty connects to GitHub, GitLab.com, GitLab Self-Managed, Azure DevOps, and Gitea. You can then browse and clone the repositories available to your accounts directly from the Clone dialog.",
steps: [
"Open Settings → Integrations, select a provider, and enter its server URL, username, and personal access token.",
"Azure DevOps supports multiple organizations. Every organization has its own display name, organization URL, and separately stored token.",
"Enable the integration and save the settings. Tokens are kept in the operating system keychain rather than application settings.",
"Open Clone → Integrations and select an account. Gitty loads every accessible repository and sorts the list alphabetically.",
"Filter by name or description when needed, select a repository and destination, and clone it directly with the stored credentials.",
],
note: "Give tokens only the required read permissions and the shortest practical lifetime. Removing a stored token in Gitty automatically disables the affected integration.",
},
{
id: "app-commit-detail",
title: "Create clean commits in Gitty",
@@ -1520,6 +1548,48 @@
label: "Neu in Gitty",
description: "Änderungen seit der letzten veröffentlichten Version und wichtige Neuerungen früherer Releases.",
sections: [
{
id: "changelog-2026-8-8",
title: "Version 2026.8.8",
summary: "Dieses Release verbindet Gitty mit den wichtigsten Git-Hosting-Diensten und macht das Klonen aus deinen eigenen Repository-Listen deutlich schneller.",
steps: [
"Neue Integrationen für GitHub, GitLab.com, GitLab Self-Managed, Azure DevOps und Gitea lassen sich zentral in den Einstellungen verwalten. Personal Access Tokens werden sicher im Schlüsselbund des Betriebssystems gespeichert.",
"Azure DevOps unterstützt mehrere Organisationen mit jeweils eigenem Anzeigenamen, eigener Organisations-URL, eigenem Benutzernamen und Token.",
"Der Clone-Dialog besitzt einen Integrationen-Reiter. Er lädt alle zugänglichen Repositories des gewählten Kontos, sortiert sie alphabetisch und unterstützt Suche, Aktualisieren und direktes Klonen mit den gespeicherten Zugangsdaten.",
"Die Repository-Tab-Leiste ist kompakter und näher an klassischen Git-Clients gestaltet. Das Schließen-X bleibt sichtbar und wird nur beim Überfahren rot.",
"Eine schmale eigene Scrollbar im Repository-Browser überdeckt weder Namen noch Metadaten und wird beim Überfahren nur leicht breiter.",
"Repository-Loading- und Status-Flächen reagieren konsistenter auf das aktive Theme und sind kompakter und kontrastreicher.",
"Das Entfernen eines nicht vorhandenen Upstreams ist jetzt ein sicherer No-op und löst keinen fatalen Git-Fehler mehr aus.",
],
note: "Die Integrationen verwenden HTTPS und Personal Access Tokens. Welche Repositories sichtbar sind, richtet sich nach den Berechtigungen des jeweiligen Tokens und Kontos.",
},
{
id: "changelog-2026-8-7",
title: "Version 2026.8.7",
summary: "Dieses Release erweitert die Darstellungseinstellungen und macht die Branch-Auswahl bei vielen lokalen und entfernten Branches übersichtlicher.",
steps: [
"In den Einstellungen stehen die Darstellungsstile Aktuell, Klassisch und Eigene zur Verfügung. Beim eigenen Stil lässt sich eine individuelle Farbpalette konfigurieren und dauerhaft speichern.",
"Ein vollständiges helles Theme ergänzt die überarbeitete dunkle Darstellung. Farben, Flächen, Bedienelemente und Fokusrahmen besitzen klarere Grenzen und konsistentere Kontraste.",
"Der Dialog zur Branch-Sichtbarkeit trennt lokale und entfernte Branches in auf- und zuklappbare Gruppen und zeigt für jede Gruppe die Anzahl der ausgewählten Branches.",
"Beim Öffnen ist die lokale Gruppe ausgeklappt und die Remote-Gruppe zunächst geschlossen, damit häufig verwendete Branches schneller erreichbar sind.",
"Die Branch-Auswahl passt sich kleineren Fenstergrößen besser an und folgt dem visuellen Stil der übrigen Gitty-Dialoge.",
],
note: "Darstellungsstil und eigene Farben werden lokal gespeichert und beim nächsten Start automatisch wieder angewendet.",
},
{
id: "changelog-2026-8-6",
title: "Version 2026.8.6",
summary: "Dieses Wartungsrelease stabilisiert Git-LFS-Workflows vom Tracking über Clone und Pull bis zum Push großer Dateien nach Azure DevOps.",
steps: [
"LFS-Muster aus der .gitattributes im Repository-Stamm bleiben im LFS-Dialog sichtbar, auch wenn die Datei noch ungetrackt ist oder zuvor durch eine Ignore-Regel ausgeblendet wurde.",
"Beim Aktivieren von Git LFS und beim Hinzufügen eines Tracking-Musters stellt Gitty sicher, dass die .gitattributes nicht ignoriert wird. Nur wenn nötig, wird die gezielte Ausnahme !/.gitattributes am Ende der .gitignore ergänzt.",
"Clone und Pull verwenden für erkannte LFS-Repositories denselben Remote und dieselben Zugangsdaten auch zum Laden der LFS-Objekte. Neue Klone aktivieren Filter und Pre-Push-Hook automatisch.",
"Wenn Azure DevOps einen großen LFS-Upload über HTTP/2 mit HTTP 413 ablehnt, wiederholt Gitty den Push einmal mit einer nur für diesen Befehl geltenden HTTP/1.1-Konfiguration. Globale und Repository-Einstellungen bleiben unverändert.",
"LFS-, Größen- und andere allgemeine Push-Fehler werden nicht mehr als Non-Fast-Forward verwechselt. Der unnötige Ablauf „Pull vor Push“ mit anschließendem „Push after pull“ erscheint nur noch bei einem tatsächlichen veralteten lokalen Branch.",
"Der Tauri-Debug-Launcher entfernt ausschließlich bekannte nicht routende Test-Proxys aus dem Gitty-Unterprozess. Echte Benutzer- und Unternehmens-Proxys bleiben erhalten, sodass Remote- und LFS-Abläufe auch im Debug-Build testbar sind.",
],
note: "Die HTTP/1.1-Wiederholung greift nur nach einem LFS-Fehler 413. Änderungen an .gitattributes und .gitignore bleiben normale Repository-Änderungen und müssen committed und gepusht werden.",
},
{
id: "changelog-2026-8-5",
title: "Version 2026.8.5",
@@ -1527,11 +1597,11 @@
steps: [
"Git LFS ist direkt über das Synchronisierungsmenü erreichbar. Gitty prüft die verfügbare Erweiterung, die Repository-Konfiguration und den Pre-Push-Hook und zeigt an, ob Git LFS mit Gitty gebündelt oder systemweit installiert ist.",
"LFS-Muster lassen sich hinzufügen, als Lockable markieren und wieder entfernen. Der Dialog zeigt außerdem die LFS-Dateien des aktuellen Checkouts, lädt fehlende Objekte und bereinigt nicht mehr benötigte Cache-Objekte.",
"Nach einem erfolgreichen Pull erkennt Gitty LFS-Repositories automatisch und lädt die benötigten LFS-Objekte mit demselben Remote und denselben Zugangsdaten. Ein zweiter manueller Pull ist nicht erforderlich.",
"Nach einem erfolgreichen Clone oder Pull erkennt Gitty LFS-Repositories automatisch und lädt die benötigten LFS-Objekte mit demselben Remote und denselben Zugangsdaten. Neue Klone aktivieren LFS außerdem lokal, sodass kein zweiter manueller Pull erforderlich ist.",
"Unstaged und Staged stehen jetzt gleich breit nebeneinander, scrollen unabhängig voneinander und verwenden eindeutige Pfeile für Stage und Unstage. Bei schmalen Fenstern wechselt die Darstellung automatisch untereinander.",
"Der mittig angeordnete List-/Tree-Umschalter zeigt Änderungen entweder als kompakte Liste oder gruppiert sie in beiden Bereichen nach aufklappbaren Ordnern.",
"Über das neu gestaltete Kontextmenü einer Datei oder eines Ordners lassen sich gezielt einzelne Dateien oder alle Änderungen im Ordner stagen, unstagen oder in einem eigenen Stash sichern. Dateiname, übergeordneter Pfad und Anzahl der betroffenen Dateien sind dabei klar voneinander getrennt.",
"Repositories können beim Start über --repo PATH oder --repo=PATH direkt geöffnet werden. Relative Pfade werden dabei aufgelöst.",
"Über das neu gestaltete Kontextmenü einer Datei oder eines Ordners lassen sich gezielt einzelne Dateien oder alle Änderungen im Ordner stagen, unstagen oder in einem eigenen Stash sichern. Neue und ungetrackte Inhalte können im Changes-Bereich und im File Explorer als exakte Datei, kompletter Ordner oder Dateiendungs-Muster in die .gitignore übernommen werden; die Ordneroption erscheint nur beim Rechtsklick auf einen Ordner. Bereits getrackte Dateien und Ordner lassen sich mit „Stop tracking“ aus dem Git-Index entfernen, bleiben aber auf der Festplatte erhalten. Dateiname, übergeordneter Pfad und Anzahl der betroffenen Dateien sind dabei klar voneinander getrennt.",
"Repositories können beim Start über --repo PATH oder --repo=PATH direkt geöffnet werden. Mit clone REMOTE ZIEL, --clone REMOTE ZIEL oder --clone=REMOTE ZIEL klont Gitty ein Remote-Repository in den exakt angegebenen lokalen Ordner und öffnet es anschließend. Relative Pfade werden gegen das aktuelle Arbeitsverzeichnis aufgelöst; der Aufruf wird auch an eine bereits laufende Gitty-Instanz weitergegeben.",
"Quadratische Bedienelemente und Flächen vereinheitlichen das Erscheinungsbild; runde Statuspunkte, Avatare und charakteristische Branch-Markierungen bleiben erhalten.",
],
note: "Von Git LFS erzeugte Änderungen an .gitattributes gehören zum Repository und müssen wie jede andere Änderung committed werden. Bereits vorhandene Git-Historie wird durch neue Tracking-Muster nicht rückwirkend umgeschrieben.",
@@ -1636,6 +1706,48 @@
label: "What's new",
description: "Changes since the latest published version and notable additions from earlier releases.",
sections: [
{
id: "changelog-2026-8-8",
title: "Version 2026.8.8",
summary: "This release connects Gitty to the major Git hosting services and makes cloning from your own repository lists substantially faster.",
steps: [
"New integrations for GitHub, GitLab.com, GitLab Self-Managed, Azure DevOps, and Gitea can be managed centrally in Settings. Personal access tokens are stored securely in the operating system keychain.",
"Azure DevOps supports multiple organizations, each with its own display name, organization URL, username, and token.",
"The Clone dialog has an Integrations tab. It loads every repository accessible to the selected account, sorts the list alphabetically, and supports search, refresh, and direct cloning with stored credentials.",
"The repository tab bar is more compact and closer to familiar Git clients. Its close button remains visible and turns red only while hovered.",
"A narrow custom scrollbar in the repository browser no longer covers names or metadata and grows only slightly on hover.",
"Repository loading and status surfaces respond more consistently to the active theme with improved contrast and a more compact presentation.",
"Clearing a missing upstream is now a safe no-op instead of producing a fatal Git error.",
],
note: "Integrations use HTTPS and personal access tokens. The repositories shown depend on the permissions granted to the selected account and token.",
},
{
id: "changelog-2026-8-7",
title: "Version 2026.8.7",
summary: "This release expands appearance settings and makes branch selection easier to navigate in repositories with many local and remote branches.",
steps: [
"Settings now provide Modern, Classic, and Custom appearance styles. Custom mode supports an individual color palette that is persisted across restarts.",
"A complete light theme complements the refreshed dark appearance. Colors, surfaces, controls, and focus outlines have clearer boundaries and more consistent contrast.",
"The branch visibility dialog separates local and remote branches into collapsible groups and displays the number of selected branches for each group.",
"The local group opens by default while the remote group starts collapsed, keeping frequently used branches quicker to reach.",
"The branch selector responds better to smaller window sizes and follows the visual language of the other Gitty dialogs.",
],
note: "The selected appearance style and custom colors are stored locally and restored automatically on the next start.",
},
{
id: "changelog-2026-8-6",
title: "Version 2026.8.6",
summary: "This maintenance release stabilizes Git LFS workflows from tracking through clone and pull to pushing large files to Azure DevOps.",
steps: [
"LFS patterns from the root .gitattributes remain visible in the LFS dialog even while the file is untracked or was previously hidden by an ignore rule.",
"When Git LFS is activated or a tracking pattern is added, Gitty ensures that .gitattributes is not ignored. Only when required, the scoped !/.gitattributes exception is appended to .gitignore.",
"Clone and pull use the same remote and credentials to download LFS objects for detected LFS repositories. Fresh clones also activate the filters and pre-push hook automatically.",
"When Azure DevOps rejects a large LFS upload over HTTP/2 with HTTP 413, Gitty retries the push once with an HTTP/1.1 setting scoped to that command. Global and repository settings remain unchanged.",
"LFS, size, and other generic push failures are no longer mistaken for non-fast-forward rejections. The Pull before push and Push after pull flow is now offered only when the local branch is genuinely behind its remote.",
"The Tauri debug launcher removes only known non-routing test proxies from the Gitty child process. Real user and company proxies are preserved, keeping remote and LFS workflows testable in debug builds.",
],
note: "The HTTP/1.1 retry runs only after an LFS HTTP 413 failure. Changes to .gitattributes and .gitignore remain ordinary repository changes that must be committed and pushed.",
},
{
id: "changelog-2026-8-5",
title: "Version 2026.8.5",
@@ -1643,11 +1755,11 @@
steps: [
"Git LFS is available directly from the Sync menu. Gitty checks the available extension, repository configuration, and pre-push hook, and reports whether Git LFS is bundled with Gitty or installed system-wide.",
"LFS patterns can be added, marked as Lockable, and removed again. The dialog also lists LFS files in the current checkout, downloads missing objects, and prunes unused cache objects.",
"After a successful pull, Gitty automatically detects LFS repositories and downloads the required LFS objects with the same remote and credentials. A second manual pull is no longer required.",
"After a successful clone or pull, Gitty automatically detects LFS repositories and downloads the required LFS objects with the same remote and credentials. Fresh clones also activate LFS locally, so a second manual pull is no longer required.",
"Unstaged and Staged now sit side by side at equal width, scroll independently, and use clear arrows for Stage and Unstage. Narrow windows automatically fall back to a vertical layout.",
"The centered List/Tree switch presents changes either as a compact list or groups them into collapsible folders in both areas.",
"The redesigned file and folder context menu can stage, unstage, or save only that file or the folder's complete set of changes in a dedicated stash. The selected name, parent path, and affected file count are now clearly separated.",
"Repositories can be opened directly at startup with --repo PATH or --repo=PATH. Relative paths are resolved automatically.",
"The redesigned file and folder context menu can stage, unstage, or save only that file or the folder's complete set of changes in a dedicated stash. In Changes and the File Explorer, new and untracked items can be added to .gitignore as an exact file, a complete folder, or an extension-wide pattern; the folder option only appears for folder selections. Tracked files and folders can be removed from the Git index with Stop tracking while remaining on disk. The selected name, parent path, and affected file count are now clearly separated.",
"Repositories can be opened directly at startup with --repo PATH or --repo=PATH. With clone REMOTE TARGET, --clone REMOTE TARGET, or --clone=REMOTE TARGET, Gitty clones a remote into the exact local folder and opens it afterward. Relative paths are resolved against the current working directory, and requests are forwarded to an already-running Gitty instance.",
"Square controls and surfaces make the interface more consistent while circular status markers, avatars, and characteristic branch shapes remain intact.",
],
note: "Changes to .gitattributes created by Git LFS belong to the repository and must be committed like any other change. New tracking patterns do not rewrite existing Git history retroactively.",
@@ -2004,7 +2116,8 @@
.help-search-icon { position: absolute; left: 12px; display: grid; color: var(--color-ink-faint); pointer-events: none; }
.help-search input { width: 100%; height: 40px; padding: 0 68px 0 39px; border-color: var(--color-border-input); border-radius: 8px; background: var(--app-input-bg); color: var(--color-ink); font-size: 12.5px; }
.help-search kbd { position: absolute; right: 8px; }
.help-close { justify-self: end; width: 36px; min-height: 36px; padding: 0; border-color: transparent; border-radius: 7px; background: transparent; color: var(--color-ink-muted); }
.help-close { justify-self: end; width: 36px; min-height: 36px; padding: 0; border-color: transparent; border-radius: 7px; background: transparent; color: var(--color-ink-muted); transition: color 120ms ease, border-color 120ms ease, background 120ms ease, box-shadow 120ms ease; }
.help-close:hover:not(:disabled), .help-close:focus-visible:not(:disabled) { color: #fff; border-color: #f0646d; background: #d93641; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.help-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 0; }
.help-nav { display: flex; flex-direction: column; min-height: 0; padding: 14px 10px 12px; border-right: 1px solid var(--color-border); background: var(--color-surface-dim); }
+37 -3
View File
@@ -117,6 +117,8 @@
let customVisibleBranches = $state<Set<string>>(new Set());
let loadedVisibilityRepository = $state("");
let branchDialogOpen = $state(false);
let localBranchGroupOpen = $state(true);
let remoteBranchGroupOpen = $state(false);
let expandedRefsCommitHash = $state("");
let panelElement = $state<HTMLElement | null>(null);
let contextCommit = $state<GitCommit | null>(null);
@@ -428,6 +430,8 @@
}
function openBranchDialog() {
localBranchGroupOpen = true;
remoteBranchGroupOpen = false;
branchDialogOpen = true;
}
@@ -1202,7 +1206,19 @@
<div class="branch-filter-dialog-list">
{#if localBranchNames.length > 0}
<span class="branch-filter-group-label">Local</span>
<section class="branch-filter-group">
<button
class="branch-filter-group-toggle"
type="button"
aria-expanded={localBranchGroupOpen}
onclick={() => { localBranchGroupOpen = !localBranchGroupOpen; }}
>
{#if localBranchGroupOpen}<ChevronDown size={14} aria-hidden="true" />{:else}<ChevronRight size={14} aria-hidden="true" />{/if}
<span>Local</span>
<em>{localBranchNames.filter(branchIsVisible).length}/{localBranchNames.length}</em>
</button>
{#if localBranchGroupOpen}
<div class="branch-filter-group-list">
{#each localBranchNames as branch}
<label class:muted={!branchIsVisible(branch)} class="branch-filter-option" title={branch}>
<input
@@ -1214,11 +1230,26 @@
<span>{branch}</span>
</label>
{/each}
</div>
{/if}
</section>
{/if}
{#if remoteBranchNames.length > 0}
<span class="branch-filter-group-label">Remote</span>
<section class="branch-filter-group">
<button
class="branch-filter-group-toggle"
type="button"
aria-expanded={remoteBranchGroupOpen}
onclick={() => { remoteBranchGroupOpen = !remoteBranchGroupOpen; }}
>
{#if remoteBranchGroupOpen}<ChevronDown size={14} aria-hidden="true" />{:else}<ChevronRight size={14} aria-hidden="true" />{/if}
<span>Remote</span>
<em>{remoteBranchNames.filter(branchIsVisible).length}/{remoteBranchNames.length}</em>
</button>
{#if remoteBranchGroupOpen}
<div class="branch-filter-group-list">
{#each remoteBranchNames as branch}
<label class:muted={!branchIsVisible(branch)} class="branch-filter-option remote" title={branch}>
<label class:muted={!branchIsVisible(branch)} class="branch-filter-option" title={branch}>
<input
type="checkbox"
checked={branchIsVisible(branch)}
@@ -1228,6 +1259,9 @@
<span>{branch}</span>
</label>
{/each}
</div>
{/if}
</section>
{/if}
</div>
</div>
@@ -0,0 +1,290 @@
<script lang="ts">
import { Building2, CheckCircle2, CircleDashed, Eye, EyeOff, KeyRound, Plus, Server, Trash2 } from "@lucide/svelte";
import { siGitea, siGithub, siGitlab, type SimpleIcon } from "simple-icons";
import { gitIntegrationProviders, organizationNameFromUrl, providerLabel } from "../integrations";
import type { AppLanguage, AzureDevOpsOrganization, GitIntegrationConfig, GitIntegrationProvider, GitIntegrationSecretUpdate, GitIntegrationSettings } from "../types";
interface Props {
language: AppLanguage;
settings: GitIntegrationSettings;
onChange: (settings: GitIntegrationSettings) => void;
onSecretsChange: (updates: GitIntegrationSecretUpdate[]) => void;
}
let { language, settings, onChange, onSecretsChange }: Props = $props();
let selected = $state<GitIntegrationProvider>("github");
let selectedAzureOrganizationId = $state("");
let tokenValues = $state<Record<string, string>>({});
let secretUpdates = $state<Record<string, GitIntegrationSecretUpdate>>({});
let showToken = $state(false);
const isGerman = $derived(language === "de");
const selectedAzureOrganization = $derived(settings.azureDevOpsOrganizations.find((organization) => organization.id === selectedAzureOrganizationId));
const current = $derived<GitIntegrationConfig | AzureDevOpsOrganization | undefined>(selected === "azure-devops" ? selectedAzureOrganization : settings.providers[selected]);
const currentAccountId = $derived(selected === "azure-devops" ? selectedAzureOrganization?.id : undefined);
const azureDevOpsIcon: SimpleIcon = {
title: "Azure DevOps", slug: "azuredevops", hex: "0078D4", source: "https://azure.microsoft.com/products/devops", svg: "",
path: "M0 8.877 2.247 5.91l8.405-3.416v19.127l-8.405-3.53L0 15.123V8.877Zm12.154-6.968 11.846 2.423v15.336l-11.846 2.423V1.909Z",
};
const providerIcons: Record<GitIntegrationProvider, SimpleIcon> = { github: siGithub, gitlab: siGitlab, "gitlab-self-hosted": siGitlab, "azure-devops": azureDevOpsIcon, gitea: siGitea };
function providerDescription(provider: GitIntegrationProvider): string {
const descriptions = isGerman
? { github: "Konto auf github.com", gitlab: "Cloud-Konto auf gitlab.com", "gitlab-self-hosted": "Eigene GitLab-Instanz", "azure-devops": "Mehrere Organisationen", gitea: "Cloud- oder eigene Instanz" }
: { github: "Cloud account on github.com", gitlab: "Cloud account on gitlab.com", "gitlab-self-hosted": "Your own GitLab instance", "azure-devops": "Multiple organizations", gitea: "Cloud or self-hosted instance" };
return descriptions[provider];
}
function providerColor(provider: GitIntegrationProvider): string {
return provider === "github" ? "var(--color-ink)" : `#${providerIcons[provider].hex}`;
}
function secretId(provider: GitIntegrationProvider, accountId?: string): string {
return accountId ? `${provider}:${accountId}` : provider;
}
function emitSecrets() {
onSecretsChange(Object.values(secretUpdates));
}
function updateCurrent(patch: Partial<GitIntegrationConfig & AzureDevOpsOrganization>) {
if (!current) return;
if (selected === "azure-devops" && selectedAzureOrganization) {
onChange({
...settings,
azureDevOpsOrganizations: settings.azureDevOpsOrganizations.map((organization) => organization.id === selectedAzureOrganization.id ? { ...organization, ...patch } : organization),
});
return;
}
onChange({ ...settings, providers: { ...settings.providers, [selected]: { ...settings.providers[selected], ...patch } } });
}
function setToken(value: string) {
if (!current) return;
const id = secretId(selected, currentAccountId);
tokenValues[id] = value;
if (value.trim()) secretUpdates[id] = { provider: selected, accountId: currentAccountId, token: value };
else delete secretUpdates[id];
tokenValues = { ...tokenValues };
secretUpdates = { ...secretUpdates };
emitSecrets();
}
function forgetToken() {
if (!current) return;
const id = secretId(selected, currentAccountId);
tokenValues[id] = "";
secretUpdates[id] = { provider: selected, accountId: currentAccountId, removeToken: true };
tokenValues = { ...tokenValues };
secretUpdates = { ...secretUpdates };
updateCurrent({ enabled: false, tokenStored: false });
emitSecrets();
}
function pendingRemoval(provider: GitIntegrationProvider, accountId?: string): boolean {
return secretUpdates[secretId(provider, accountId)]?.removeToken === true;
}
function tokenValue(): string {
return tokenValues[secretId(selected, currentAccountId)] ?? "";
}
function selectProvider(provider: GitIntegrationProvider) {
selected = provider;
showToken = false;
if (provider === "azure-devops" && !settings.azureDevOpsOrganizations.some((organization) => organization.id === selectedAzureOrganizationId)) {
selectedAzureOrganizationId = settings.azureDevOpsOrganizations[0]?.id ?? "";
}
}
function createOrganizationId(): string {
if (typeof crypto !== "undefined" && "randomUUID" in crypto) return crypto.randomUUID();
return `org-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
}
function addAzureOrganization() {
const id = createOrganizationId();
const number = settings.azureDevOpsOrganizations.length + 1;
const organization: AzureDevOpsOrganization = {
id,
name: isGerman ? `Organisation ${number}` : `Organization ${number}`,
enabled: true,
baseUrl: "https://dev.azure.com/",
username: "",
tokenStored: false,
};
onChange({ ...settings, azureDevOpsOrganizations: [...settings.azureDevOpsOrganizations, organization] });
selectedAzureOrganizationId = id;
showToken = false;
}
function removeAzureOrganization(organization: AzureDevOpsOrganization) {
const id = secretId("azure-devops", organization.id);
if (organization.tokenStored) secretUpdates[id] = { provider: "azure-devops", accountId: organization.id, removeToken: true };
else delete secretUpdates[id];
delete tokenValues[id];
secretUpdates = { ...secretUpdates };
tokenValues = { ...tokenValues };
const remaining = settings.azureDevOpsOrganizations.filter((candidate) => candidate.id !== organization.id);
onChange({ ...settings, azureDevOpsOrganizations: remaining });
selectedAzureOrganizationId = remaining[0]?.id ?? "";
showToken = false;
emitSecrets();
}
function organizationDisplayName(organization: AzureDevOpsOrganization): string {
return organization.name.trim() || organizationNameFromUrl(organization.baseUrl) || (isGerman ? "Unbenannte Organisation" : "Unnamed organization");
}
function isOrganizationConfigured(organization: AzureDevOpsOrganization): boolean {
return organization.tokenStored && organization.baseUrl.trim().length > 0 && !pendingRemoval("azure-devops", organization.id);
}
function isConfigured(provider: GitIntegrationProvider): boolean {
if (provider === "azure-devops") return settings.azureDevOpsOrganizations.some(isOrganizationConfigured);
const config = settings.providers[provider];
return config.tokenStored && config.baseUrl.trim().length > 0 && !pendingRemoval(provider);
}
function currentConfigured(): boolean {
if (!current) return false;
return current.tokenStored && current.baseUrl.trim().length > 0 && !pendingRemoval(selected, currentAccountId);
}
function baseUrlPlaceholder(): string {
if (selected === "azure-devops") return "https://dev.azure.com/meine-organisation";
if (selected === "github") return "https://github.com";
if (selected === "gitlab") return "https://gitlab.com";
if (selected === "gitlab-self-hosted") return "https://gitlab.example.com";
return "https://gitea.example.com";
}
</script>
<div class="integration-layout">
<div class="integration-providers" role="tablist" aria-label={isGerman ? "Git-Anbieter" : "Git providers"}>
{#each gitIntegrationProviders as provider}
<button type="button" role="tab" aria-selected={selected === provider} class:active={selected === provider} onclick={() => selectProvider(provider)}>
<span class="provider-logo" style={`--provider-color:${providerColor(provider)}`}><svg viewBox="0 0 24 24" aria-hidden="true"><path d={providerIcons[provider].path} /></svg></span>
<span class="provider-copy"><strong>{providerLabel(provider)}</strong><small>{providerDescription(provider)}</small></span>
<span class="provider-state" class:configured={isConfigured(provider)} title={isConfigured(provider) ? (isGerman ? "Konfiguriert" : "Configured") : (isGerman ? "Nicht verbunden" : "Not connected")}></span>
</button>
{/each}
</div>
<section class="integration-config" aria-label={`${providerLabel(selected)} ${isGerman ? "konfigurieren" : "configuration"}`}>
<header class="integration-summary">
<span class="provider-logo provider-logo-large" style={`--provider-color:${providerColor(selected)}`}><svg viewBox="0 0 24 24" aria-hidden="true"><path d={providerIcons[selected].path} /></svg></span>
<div><h4>{providerLabel(selected)}</h4><p>{providerDescription(selected)}</p></div>
{#if selected === "azure-devops"}
<span class="integration-status" class:configured={isConfigured(selected)}><Building2 size={13} />{settings.azureDevOpsOrganizations.length} {isGerman ? "Orgas" : "orgs"}</span>
{:else}
<span class="integration-status" class:configured={currentConfigured()}>{#if currentConfigured()}<CheckCircle2 size={13} />{:else}<CircleDashed size={13} />{/if}{currentConfigured() ? (isGerman ? "Konfiguriert" : "Configured") : (isGerman ? "Nicht verbunden" : "Not connected")}</span>
{/if}
</header>
{#if selected === "azure-devops"}
<div class="azure-organizations">
<div class="azure-organizations-head"><div><strong>{isGerman ? "Organisationen" : "Organizations"}</strong><small>{isGerman ? "Jede Organisation verwendet einen eigenen Token." : "Each organization uses its own token."}</small></div><button type="button" onclick={addAzureOrganization}><Plus size={14} />{isGerman ? "Hinzufügen" : "Add"}</button></div>
{#if settings.azureDevOpsOrganizations.length === 0}
<div class="azure-organizations-empty"><Building2 size={22} /><span>{isGerman ? "Noch keine Azure-DevOps-Organisation angelegt." : "No Azure DevOps organization has been added yet."}</span><button type="button" onclick={addAzureOrganization}><Plus size={14} />{isGerman ? "Erste Organisation anlegen" : "Add first organization"}</button></div>
{:else}
<div class="azure-organization-list" role="tablist" aria-label={isGerman ? "Azure-DevOps-Organisationen" : "Azure DevOps organizations"}>
{#each settings.azureDevOpsOrganizations as organization (organization.id)}
<div class="azure-organization-row" class:active={selectedAzureOrganizationId === organization.id}>
<button type="button" role="tab" aria-selected={selectedAzureOrganizationId === organization.id} onclick={() => { selectedAzureOrganizationId = organization.id; showToken = false; }}>
<span><strong>{organizationDisplayName(organization)}</strong><small>{organization.baseUrl}</small></span><i class:configured={isOrganizationConfigured(organization)}></i>
</button>
<button class="azure-remove" type="button" onclick={() => removeAzureOrganization(organization)} title={isGerman ? "Organisation entfernen" : "Remove organization"} aria-label={`${organizationDisplayName(organization)} ${isGerman ? "entfernen" : "remove"}`}><Trash2 size={13} /></button>
</div>
{/each}
</div>
{/if}
</div>
{/if}
{#if current}
{#if selected === "azure-devops"}
<label class="integration-field"><span><Building2 size={13} />{isGerman ? "Anzeigename" : "Display name"}</span><input value={selectedAzureOrganization?.name ?? ""} oninput={(event) => updateCurrent({ name: event.currentTarget.value })} placeholder={isGerman ? "z. B. Contoso Platform" : "e.g. Contoso Platform"} /></label>
{/if}
<label class="integration-field">
<span><Server size={13} />{selected === "azure-devops" ? (isGerman ? "Organisations-URL" : "Organization URL") : (isGerman ? "Server-URL" : "Server URL")}</span>
<input value={current.baseUrl} oninput={(event) => updateCurrent({ baseUrl: event.currentTarget.value })} placeholder={baseUrlPlaceholder()} spellcheck="false" inputmode="url" />
<small>{isGerman ? "Basis-URL ohne Repository-Pfad." : "Base URL without a repository path."}</small>
</label>
<label class="integration-field"><span>{isGerman ? "Benutzername oder E-Mail" : "Username or email"}</span><input value={current.username} oninput={(event) => updateCurrent({ username: event.currentTarget.value })} autocomplete="off" placeholder={selected === "azure-devops" ? "name@example.com" : (isGerman ? "Benutzername" : "Username")} spellcheck="false" /></label>
<label class="integration-field">
<span><KeyRound size={13} />Personal Access Token</span>
<div class="token-row"><input type={showToken ? "text" : "password"} value={tokenValue()} oninput={(event) => setToken(event.currentTarget.value)} autocomplete="new-password" placeholder={current.tokenStored && !pendingRemoval(selected, currentAccountId) ? (isGerman ? "Token ist sicher gespeichert" : "Token is stored securely") : (isGerman ? "Token einfügen" : "Paste token")} spellcheck="false" /><button type="button" onclick={() => { showToken = !showToken; }} title={showToken ? (isGerman ? "Token ausblenden" : "Hide token") : (isGerman ? "Token anzeigen" : "Show token")} aria-label={showToken ? (isGerman ? "Token ausblenden" : "Hide token") : (isGerman ? "Token anzeigen" : "Show token")}>{#if showToken}<EyeOff size={15} />{:else}<Eye size={15} />{/if}</button></div>
<small>{isGerman ? "Der Token wird separat im Schlüsselbund des Betriebssystems gespeichert." : "The token is stored separately in the operating system keychain."}</small>
</label>
<div class="integration-actions">
<label class="integration-enabled"><span><strong>{selected === "azure-devops" ? (isGerman ? "Organisation aktivieren" : "Enable organization") : (isGerman ? "Integration aktivieren" : "Enable integration")}</strong><small>{isGerman ? "Für Hosting- und Clone-Funktionen verwenden." : "Use for hosting and clone features."}</small></span><input type="checkbox" checked={current.enabled} onchange={(event) => updateCurrent({ enabled: event.currentTarget.checked })} /></label>
{#if current.tokenStored && !pendingRemoval(selected, currentAccountId)}<button class="forget-token" type="button" onclick={forgetToken}><Trash2 size={14} />{isGerman ? "Gespeicherten Token entfernen" : "Remove stored token"}</button>{/if}
</div>
{/if}
</section>
</div>
<style>
.integration-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 14px; min-height: 420px; }
.integration-providers { display: flex; flex-direction: column; gap: 5px; }
.integration-providers > button { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 64px; padding: 9px 10px; border: 1px solid var(--color-border-subtle); border-radius: 9px; color: var(--color-ink-dim); background: var(--app-settings-row-bg); text-align: left; }
.integration-providers > button:hover { color: var(--color-ink); border-color: var(--color-border); background: var(--color-surface-hover); }
.integration-providers > button.active { border-color: color-mix(in srgb, var(--color-accent) 34%, var(--color-border)); color: var(--color-ink); background: color-mix(in srgb, var(--color-accent) 8%, var(--color-surface-raised)); box-shadow: inset 2px 0 0 var(--color-accent); }
.provider-logo { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid color-mix(in srgb, var(--provider-color) 34%, var(--color-border)); border-radius: 8px; color: var(--provider-color); background: color-mix(in srgb, var(--provider-color) 10%, transparent); }
.provider-logo svg { width: 17px; height: 17px; fill: currentColor; }
.provider-logo-large { width: 42px; height: 42px; border-radius: 10px; }
.provider-logo-large svg { width: 22px; height: 22px; }
.provider-copy { display: grid; min-width: 0; gap: 3px; }
.provider-copy strong { color: inherit; font-size: 11px; }
.provider-copy small { overflow: hidden; color: var(--color-ink-faint); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.provider-state { width: 7px; height: 7px; border-radius: 50%; background: var(--color-ink-faint); }
.provider-state.configured { background: var(--color-success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-success) 12%, transparent); }
.integration-config { display: grid; align-content: start; gap: 13px; min-width: 0; padding: 16px; border: 1px solid var(--color-border-subtle); border-radius: 12px; background: color-mix(in srgb, var(--app-settings-row-bg) 72%, transparent); }
.integration-summary { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 11px; padding-bottom: 13px; border-bottom: 1px solid var(--color-border-subtle); }
.integration-summary h4 { margin: 0; color: var(--color-ink); font-size: 14px; }
.integration-summary p { margin: 3px 0 0; color: var(--color-ink-dim); font-size: 10.5px; }
.integration-status { display: inline-flex; align-items: center; gap: 5px; padding: 5px 7px; border: 1px solid var(--color-border-subtle); border-radius: 6px; color: var(--color-ink-faint); font-size: 9px; font-weight: 750; }
.integration-status.configured { border-color: color-mix(in srgb, var(--color-success) 24%, var(--color-border)); color: var(--color-success); background: color-mix(in srgb, var(--color-success) 6%, transparent); }
.azure-organizations { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--color-border-subtle); border-radius: 9px; background: var(--color-surface-raised); }
.azure-organizations-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.azure-organizations-head > div { display: grid; gap: 2px; }
.azure-organizations-head strong { color: var(--color-ink); font-size: 10.5px; }
.azure-organizations-head small { color: var(--color-ink-faint); font-size: 8.5px; }
.azure-organizations-head button, .azure-organizations-empty button { min-height: 27px; padding: 0 8px; font-size: 9.5px; font-weight: 750; }
.azure-organization-list { display: grid; gap: 5px; max-height: 142px; overflow: auto; }
.azure-organization-row { display: grid; grid-template-columns: minmax(0, 1fr) 30px; gap: 4px; border: 1px solid var(--color-border-subtle); border-radius: 7px; background: color-mix(in srgb, var(--app-settings-row-bg) 72%, transparent); }
.azure-organization-row.active { border-color: color-mix(in srgb, var(--color-accent) 38%, var(--color-border)); box-shadow: inset 2px 0 0 var(--color-accent); }
.azure-organization-row > button:first-child { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; min-height: 42px; padding: 5px 8px; border: 0; color: var(--color-ink-dim); background: transparent; text-align: left; }
.azure-organization-row > button:first-child span { display: grid; min-width: 0; gap: 2px; }
.azure-organization-row strong, .azure-organization-row small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.azure-organization-row strong { color: var(--color-ink); font-size: 10px; }
.azure-organization-row small { color: var(--color-ink-faint); font-size: 8.5px; }
.azure-organization-row i { width: 6px; height: 6px; border-radius: 50%; background: var(--color-ink-faint); }
.azure-organization-row i.configured { background: var(--color-success); }
.azure-remove { min-height: 30px; align-self: center; padding: 0; border: 0; color: var(--color-ink-faint); background: transparent; }
.azure-remove:hover { color: #e86060; background: color-mix(in srgb, #e86060 8%, transparent); }
.azure-organizations-empty { display: grid; place-items: center; gap: 7px; padding: 14px; color: var(--color-ink-faint); text-align: center; }
.azure-organizations-empty > :global(svg) { color: var(--color-accent); }
.azure-organizations-empty span { font-size: 9.5px; }
.integration-field { display: grid; gap: 6px; min-width: 0; color: var(--color-ink-muted); font-size: 10.5px; font-weight: 750; }
.integration-field > span { display: flex; align-items: center; gap: 5px; }
.integration-field input { height: 36px; border-color: var(--color-border); background: var(--color-surface-raised); font-size: 11px; }
.integration-field small { color: var(--color-ink-faint); font-size: 9.5px; font-weight: 500; }
.token-row { display: grid; grid-template-columns: minmax(0, 1fr) 36px; gap: 6px; }
.token-row button { display: grid; place-items: center; min-height: 36px; padding: 0; }
.integration-actions { display: grid; gap: 10px; padding-top: 2px; }
.integration-enabled { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 11px 12px; border: 1px solid var(--color-border-subtle); border-radius: 8px; background: var(--color-surface-raised); }
.integration-enabled > span { display: grid; gap: 3px; }
.integration-enabled strong { color: var(--color-ink); font-size: 10.5px; }
.integration-enabled small { color: var(--color-ink-faint); font-size: 9px; }
.integration-enabled input { width: 32px; height: 18px; accent-color: var(--color-accent); }
.forget-token { justify-self: start; min-height: 28px; color: #e86060; font-size: 10px; }
@media (max-width: 680px) { .integration-layout { grid-template-columns: 1fr; min-height: 0; } .integration-providers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); } .integration-providers > button { min-height: 54px; } .provider-copy small { display: none; } }
@media (max-width: 430px) { .integration-providers { grid-template-columns: 1fr; } .integration-summary { grid-template-columns: auto minmax(0, 1fr); } .integration-status { grid-column: 1 / -1; justify-self: start; } .azure-organizations-head { align-items: stretch; flex-direction: column; } .azure-organizations-head button { align-self: start; } }
</style>
+1 -1
View File
@@ -277,7 +277,7 @@
<span class="eyebrow">{scopeLabel}</span>
<p class="dialog-title" title={displayPath}>{displayPath}</p>
</div>
<div class="dialog-header-actions">
<div class="dialog-header-actions line-patch-header-actions">
<div class="tool-surface-choice" aria-label={isGerman ? "Diff öffnen mit" : "Open diff with"}>
<span>{isGerman ? "Öffnen mit" : "Open with"}</span>
<button class="active" type="button" aria-pressed="true" title={isGerman ? "In Gitty anzeigen" : "Show in Gitty"}>
+53 -81
View File
@@ -33,7 +33,7 @@
<style>
.repo-loading {
position: fixed;
top: calc(var(--app-titlebar-height, 42px) + 56px);
top: calc(var(--app-titlebar-height, 40px) + var(--app-repo-tabbar-height, 36px));
right: 0;
bottom: 0;
left: 0;
@@ -41,17 +41,24 @@
display: grid;
place-items: center;
overflow: hidden;
background: linear-gradient(135deg, #070a10 0%, #0c111a 48%, #090e16 100%);
background:
radial-gradient(
circle at 50% 42%,
color-mix(in srgb, var(--color-accent) 13%, transparent),
transparent 38%
),
color-mix(in srgb, var(--app-dialog-bg) 78%, #05070a 22%);
backdrop-filter: blur(9px);
animation: overlay-in 180ms ease;
}
.repo-loading-grid {
position: absolute;
inset: 0;
opacity: 0.28;
opacity: 0.34;
background-image:
linear-gradient(rgba(111, 140, 255, 0.09) 1px, transparent 1px),
linear-gradient(90deg, rgba(77, 182, 214, 0.07) 1px, transparent 1px);
linear-gradient(color-mix(in srgb, var(--color-primary) 9%, transparent) 1px, transparent 1px),
linear-gradient(90deg, color-mix(in srgb, var(--color-accent) 8%, transparent) 1px, transparent 1px);
background-size: 42px 42px;
mask-image: radial-gradient(circle at center, black 0%, transparent 68%);
animation: grid-drift 10s linear infinite;
@@ -62,23 +69,21 @@
display: flex;
flex-direction: column;
align-items: center;
gap: 18px;
width: min(420px, calc(100vw - 42px));
padding: 30px 34px 28px;
border: 1px solid rgba(90, 111, 154, 0.28);
border-radius: 16px;
gap: 14px;
width: min(360px, calc(100vw - 32px));
padding: 26px 30px 24px;
border: 1px solid var(--color-border-input);
border-radius: 14px;
background:
linear-gradient(180deg, rgba(23, 29, 43, 0.92), rgba(12, 17, 27, 0.94)),
var(--color-surface-raised);
box-shadow:
0 26px 78px rgba(0, 0, 0, 0.54),
inset 0 1px 0 rgba(255, 255, 255, 0.05);
var(--app-panel-highlight),
var(--app-dialog-bg);
box-shadow: var(--app-dialog-shadow);
}
.repo-loading-mark {
position: relative;
width: 168px;
height: 168px;
width: 116px;
height: 116px;
display: grid;
place-items: center;
isolation: isolate;
@@ -86,25 +91,25 @@
.repo-loading-halo {
position: absolute;
inset: 10px;
border: 1px solid rgba(111, 140, 255, 0.22);
border-radius: 34px;
inset: 8px;
border: 1px solid color-mix(in srgb, var(--color-primary) 34%, transparent);
border-radius: 24px;
transform: rotate(45deg);
}
.repo-loading-halo.halo-one {
animation: halo-breathe 2.4s ease-in-out infinite;
}
.repo-loading-halo.halo-two {
inset: 24px;
border-color: rgba(77, 182, 214, 0.24);
inset: 18px;
border-color: color-mix(in srgb, var(--color-accent) 38%, transparent);
animation: halo-breathe 2.4s ease-in-out infinite reverse;
}
.repo-loading-traces {
position: absolute;
inset: -18px;
width: 204px;
height: 204px;
inset: -14px;
width: 144px;
height: 144px;
overflow: visible;
z-index: 0;
}
@@ -114,18 +119,18 @@
stroke-linecap: round;
stroke-dasharray: 165;
stroke-dashoffset: 165;
filter: drop-shadow(0 0 8px rgba(77, 182, 214, 0.32));
filter: drop-shadow(0 0 7px color-mix(in srgb, var(--color-accent) 38%, transparent));
animation: trace-draw 2.6s ease-in-out infinite;
}
.repo-loading-traces .trace-main {
stroke: #6f8cff;
stroke: var(--color-primary);
}
.repo-loading-traces .trace-branch {
stroke: #4db6d6;
stroke: var(--color-accent);
animation-delay: 0.28s;
}
.repo-loading-traces .trace-cut {
stroke: rgba(177, 186, 208, 0.42);
stroke: color-mix(in srgb, var(--color-ink-muted) 52%, transparent);
stroke-dasharray: 128;
stroke-dashoffset: 128;
animation-delay: 0.55s;
@@ -134,12 +139,12 @@
.repo-loading-icon {
position: relative;
z-index: 1;
width: 132px;
height: 132px;
width: 82px;
height: 82px;
object-fit: contain;
filter:
drop-shadow(0 18px 24px rgba(0, 0, 0, 0.55))
drop-shadow(0 0 18px rgba(77, 182, 214, 0.2));
drop-shadow(0 10px 16px color-mix(in srgb, var(--color-ink) 24%, transparent))
drop-shadow(0 0 14px color-mix(in srgb, var(--color-accent) 24%, transparent));
animation: icon-float 2.4s ease-in-out infinite;
}
@@ -153,16 +158,16 @@
.repo-loading-label {
color: var(--color-ink);
font-size: 15px;
font-weight: 800;
font-size: 14px;
font-weight: 750;
}
.repo-loading-name {
max-width: 260px;
max-width: 250px;
overflow: hidden;
color: var(--color-ink-faint);
font-family: var(--font-mono);
font-size: 12.5px;
font-size: 12px;
text-overflow: ellipsis;
white-space: nowrap;
}
@@ -172,60 +177,20 @@
width: min(230px, 100%);
height: 4px;
overflow: hidden;
border: 1px solid var(--color-border-subtle);
border-radius: 999px;
background: rgba(111, 140, 255, 0.14);
background: color-mix(in srgb, var(--color-primary) 12%, var(--color-surface-dim));
}
.repo-loading-bar span {
position: absolute;
inset: 0;
width: 46%;
border-radius: inherit;
background: linear-gradient(90deg, transparent, #6f8cff 40%, #4db6d6 74%, transparent);
box-shadow: 0 0 16px rgba(77, 182, 214, 0.26);
background: linear-gradient(90deg, transparent, var(--color-primary) 40%, var(--color-accent) 74%, transparent);
box-shadow: 0 0 14px color-mix(in srgb, var(--color-accent) 32%, transparent);
animation: bar-slide 1.35s ease-in-out infinite;
}
:global(:root[data-theme="light"]) .repo-loading {
background:
radial-gradient(circle at 50% 42%, rgba(49, 95, 214, 0.12), transparent 34%),
linear-gradient(135deg, #f7f9fd 0%, #eef3f9 48%, #f8fafc 100%);
}
:global(:root[data-theme="light"]) .repo-loading-grid {
opacity: 0.38;
background-image:
linear-gradient(rgba(49, 95, 214, 0.1) 1px, transparent 1px),
linear-gradient(90deg, rgba(15, 143, 181, 0.08) 1px, transparent 1px);
}
:global(:root[data-theme="light"]) .repo-loading-card {
border-color: rgba(61, 89, 142, 0.2);
background:
linear-gradient(180deg, rgba(255,255,255,0.96), rgba(244,247,252,0.94)),
var(--color-surface-raised);
box-shadow:
0 26px 72px rgba(28,44,74,0.18),
inset 0 1px 0 rgba(255,255,255,0.9);
}
:global(:root[data-theme="light"]) .repo-loading-traces .trace {
filter: drop-shadow(0 0 8px rgba(49,95,214,0.22));
}
:global(:root[data-theme="light"]) .repo-loading-traces .trace-cut {
stroke: rgba(49,95,214,0.34);
}
:global(:root[data-theme="light"]) .repo-loading-icon {
filter:
drop-shadow(0 18px 24px rgba(28,44,74,0.2))
drop-shadow(0 0 18px rgba(49,95,214,0.18));
}
:global(:root[data-theme="light"]) .repo-loading-bar {
background: rgba(49,95,214,0.12);
}
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes grid-drift { to { transform: translate3d(42px, 42px, 0); } }
@keyframes icon-float {
@@ -254,4 +219,11 @@
.repo-loading-bar span { animation: none; }
.repo-loading-traces .trace { stroke-dashoffset: 0; opacity: 0.72; }
}
@media (max-width: 520px) {
.repo-loading-card {
width: calc(100vw - 20px);
padding: 22px 20px 20px;
}
}
</style>
+126 -19
View File
@@ -4,13 +4,18 @@
ArrowLeft,
ArrowRight,
FileDiff,
FileMinus2,
FileType,
FileX,
Folder,
FolderOpen,
FolderMinus,
FolderTree,
FolderX,
RotateCcw,
} from "@lucide/svelte";
import iconUrl from "../../../src-tauri/icons/icon.png";
import type { FileStatusKind, GitFileStatus, GitStatus } from "../types";
import type { FileStatusKind, GitFileStatus, GitIgnoreKind, GitStatus } from "../types";
interface Props {
changedFiles: GitFileStatus[];
@@ -27,6 +32,8 @@
onDiscard: (files: GitFileStatus[], staged: boolean) => void;
onDiscardMany: (files: GitFileStatus[]) => void;
onStash: (files: GitFileStatus[], label: string) => void;
onIgnore: (target: string, kind: GitIgnoreKind) => void;
onStopTracking: (target: string, kind: "file" | "folder") => void;
onPatch: (file: GitFileStatus, staged: boolean) => void;
onStageAll: () => void;
onUnstageAll: () => void;
@@ -76,6 +83,8 @@
onDiscard = () => {},
onDiscardMany = () => {},
onStash = () => {},
onIgnore = () => {},
onStopTracking = () => {},
onPatch = () => {},
onStageAll = () => {},
onUnstageAll = () => {},
@@ -188,6 +197,7 @@
let statusContextTarget = $state<StatusContextTarget | null>(null);
let statusContextMenuX = $state(0);
let statusContextMenuY = $state(0);
let statusContextMenuElement = $state<HTMLDivElement | null>(null);
function toggleStatusFolder(lane: StatusLaneKind, path: string) {
const next = new Set(collapsedStatusFolders);
@@ -220,6 +230,12 @@
statusContextMenuX = Math.max(8, Math.min(event.clientX, window.innerWidth - 288));
statusContextMenuY = Math.max(8, Math.min(event.clientY, window.innerHeight - 174));
statusContextTarget = { lane, kind, label, files };
requestAnimationFrame(() => {
if (!statusContextMenuElement) return;
const bounds = statusContextMenuElement.getBoundingClientRect();
statusContextMenuX = Math.max(8, Math.min(event.clientX, window.innerWidth - bounds.width - 8));
statusContextMenuY = Math.max(8, Math.min(event.clientY, window.innerHeight - bounds.height - 8));
});
}
function statusContextName(label: string): string {
@@ -252,6 +268,45 @@
onStash(target.files, target.label);
}
function isIgnoreableNewFile(file: GitFileStatus): boolean {
const path = file.path.replace(/\\/g, "/").toLowerCase();
if (path === ".gitignore") return false;
return file.unstaged === "untracked" || (file.staged === "added" && file.old_path === null);
}
function isTrackedStatusFile(file: GitFileStatus): boolean {
return file.unstaged !== "untracked" && file.staged !== "deleted";
}
function statusContextExtension(label: string): string {
const name = statusContextName(label);
const separator = name.lastIndexOf(".");
return separator > 0 && separator < name.length - 1 ? name.slice(separator + 1) : "";
}
function statusContextFolder(target: StatusContextTarget): string {
if (target.kind === "folder") return target.label.replace(/\\/g, "/").replace(/\/+$/, "");
const normalized = target.label.replace(/\\/g, "/");
const separator = normalized.lastIndexOf("/");
return separator > 0 ? normalized.slice(0, separator) : "";
}
function runStatusContextIgnoreAction(kind: GitIgnoreKind) {
const target = statusContextTarget;
if (!target) return;
const ignoreTarget = kind === "folder" ? statusContextFolder(target) : target.label;
if (!ignoreTarget) return;
closeStatusContextMenu();
onIgnore(ignoreTarget, kind);
}
function runStatusContextStopTracking() {
const target = statusContextTarget;
if (!target) return;
closeStatusContextMenu();
onStopTracking(target.label, target.kind);
}
function handleStatusWindowKeydown(event: KeyboardEvent) {
if (event.key === "Escape") closeStatusContextMenu();
}
@@ -340,6 +395,10 @@
let visibleStagedRows = $derived(statusView === "tree" ? flattenStatusTree(stagedTree, "staged") : listStatusRows(stagedFiles));
let selectedUnstagedCount = $derived(changedFiles.filter((f) => selectedStatusPaths.has(fileKey(f)) && f.unstaged !== null).length);
let selectedStagedCount = $derived(changedFiles.filter((f) => selectedStatusPaths.has(fileKey(f)) && f.staged !== null).length);
let statusContextCanIgnore = $derived(statusContextTarget?.files.some(isIgnoreableNewFile) ?? false);
let statusContextCanStopTracking = $derived(statusContextTarget?.files.some(isTrackedStatusFile) ?? false);
let statusContextIgnoreExtension = $derived(statusContextTarget?.kind === "file" ? statusContextExtension(statusContextTarget.label) : "");
let statusContextIgnoreFolder = $derived(statusContextTarget ? statusContextFolder(statusContextTarget) : "");
$effect(() => {
const validKeys = new Set(changedFiles.map(fileKey));
@@ -517,7 +576,7 @@
</section>
{#if statusContextTarget}
<div class="status-context-menu" style={`left: ${statusContextMenuX}px; top: ${statusContextMenuY}px;`} role="menu" tabindex="-1" aria-label={`Actions for ${statusContextTarget.label}`} onclick={(event) => event.stopPropagation()} onkeydown={(event) => { if (event.key === "Escape") closeStatusContextMenu(); event.stopPropagation(); }}>
<div bind:this={statusContextMenuElement} class="status-context-menu" style={`left: ${statusContextMenuX}px; top: ${statusContextMenuY}px;`} role="menu" tabindex="-1" aria-label={`Actions for ${statusContextTarget.label}`} onclick={(event) => event.stopPropagation()} onkeydown={(event) => { if (event.key === "Escape") closeStatusContextMenu(); event.stopPropagation(); }}>
<div class="status-context-label">
<span class="status-context-object-icon" aria-hidden="true">
{#if statusContextTarget.kind === "folder"}<FolderOpen size={16} />{:else}<FileDiff size={16} />{/if}
@@ -547,6 +606,49 @@
<span>Save {statusContextTarget.files.length === 1 ? "this file" : `${statusContextTarget.files.length} files`} for later</span>
</span>
</button>
{#if statusContextCanIgnore || statusContextCanStopTracking}
<div class="menu-separator" role="separator"></div>
{/if}
{#if statusContextCanStopTracking}
<button type="button" role="menuitem" onclick={runStatusContextStopTracking} disabled={isBusy} title="Keep the working-tree content and remove it from the Git index">
<span class="status-context-action-icon untrack" aria-hidden="true">
{#if statusContextTarget.kind === "folder"}<FolderMinus size={15} />{:else}<FileMinus2 size={15} />{/if}
</span>
<span class="status-context-action-copy">
<strong>Stop tracking {statusContextTarget.kind}</strong>
<span>Keep it on disk and remove it from Git</span>
</span>
</button>
{/if}
{#if statusContextCanIgnore}
{#if statusContextTarget.kind === "file"}
<button type="button" role="menuitem" onclick={() => runStatusContextIgnoreAction("file")} disabled={isBusy} title={`Add /${statusContextTarget.label.replace(/\\/g, "/")} to .gitignore`}>
<span class="status-context-action-icon ignore" aria-hidden="true"><FileX size={15} /></span>
<span class="status-context-action-copy">
<strong>Ignore file</strong>
<span>Add only this file to .gitignore</span>
</span>
</button>
{/if}
{#if statusContextIgnoreExtension}
<button type="button" role="menuitem" onclick={() => runStatusContextIgnoreAction("extension")} disabled={isBusy} title={`Add *.${statusContextIgnoreExtension} to .gitignore`}>
<span class="status-context-action-icon ignore" aria-hidden="true"><FileType size={15} /></span>
<span class="status-context-action-copy">
<strong>Ignore all *.{statusContextIgnoreExtension} files</strong>
<span>Match this file type repository-wide</span>
</span>
</button>
{/if}
{#if statusContextTarget.kind === "folder" && statusContextIgnoreFolder}
<button type="button" role="menuitem" onclick={() => runStatusContextIgnoreAction("folder")} disabled={isBusy} title={`Add /${statusContextIgnoreFolder}/ to .gitignore`}>
<span class="status-context-action-icon ignore" aria-hidden="true"><FolderX size={15} /></span>
<span class="status-context-action-copy">
<strong>Ignore folder</strong>
<span>Add this folder and its contents to .gitignore</span>
</span>
</button>
{/if}
{/if}
</div>
{/if}
@@ -558,8 +660,12 @@
display: grid;
place-items: center;
background:
radial-gradient(circle at 50% 38%, rgba(111, 140, 255, 0.1), transparent 55%),
rgba(7, 10, 16, 0.62);
radial-gradient(
circle at 50% 38%,
color-mix(in srgb, var(--color-accent) 13%, transparent),
transparent 55%
),
var(--app-dialog-backdrop);
backdrop-filter: blur(4px);
animation: status-panel-overlay-in 120ms ease;
}
@@ -571,13 +677,13 @@
gap: 12px;
width: min(300px, calc(100% - 32px));
padding: 26px 28px 26px;
border: 1px solid rgba(90, 111, 154, 0.28);
border: 1px solid var(--color-border-input);
border-radius: 16px;
background:
linear-gradient(180deg, rgba(23, 29, 43, 0.92), rgba(12, 17, 27, 0.94)),
var(--color-surface-raised);
var(--app-panel-highlight),
var(--app-dialog-bg);
color: var(--color-ink);
box-shadow: 0 18px 44px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.05);
box-shadow: var(--app-dialog-shadow);
}
.status-panel-overlay-mark {
@@ -592,7 +698,7 @@
.status-panel-overlay-halo {
position: absolute;
inset: 6px;
border: 1px solid rgba(111, 140, 255, 0.22);
border: 1px solid color-mix(in srgb, var(--color-primary) 34%, transparent);
border-radius: 22px;
transform: rotate(45deg);
}
@@ -601,7 +707,7 @@
}
.status-panel-overlay-halo.halo-two {
inset: 16px;
border-color: rgba(77, 182, 214, 0.24);
border-color: color-mix(in srgb, var(--color-accent) 38%, transparent);
animation: status-panel-overlay-halo-breathe 2.4s ease-in-out infinite reverse;
}
@@ -619,16 +725,16 @@
stroke-linecap: round;
stroke-dasharray: 165;
stroke-dashoffset: 165;
filter: drop-shadow(0 0 6px rgba(77, 182, 214, 0.32));
filter: drop-shadow(0 0 6px color-mix(in srgb, var(--color-accent) 38%, transparent));
animation: status-panel-overlay-trace-draw 2.6s ease-in-out infinite;
}
.status-panel-overlay-traces .trace-main { stroke: #6f8cff; }
.status-panel-overlay-traces .trace-main { stroke: var(--color-primary); }
.status-panel-overlay-traces .trace-branch {
stroke: #4db6d6;
stroke: var(--color-accent);
animation-delay: 0.28s;
}
.status-panel-overlay-traces .trace-cut {
stroke: rgba(177, 186, 208, 0.42);
stroke: color-mix(in srgb, var(--color-ink-muted) 52%, transparent);
stroke-dasharray: 128;
stroke-dashoffset: 128;
animation-delay: 0.55s;
@@ -641,8 +747,8 @@
height: 64px;
object-fit: contain;
filter:
drop-shadow(0 8px 12px rgba(0, 0, 0, 0.5))
drop-shadow(0 0 10px rgba(77, 182, 214, 0.2));
drop-shadow(0 8px 12px color-mix(in srgb, var(--color-ink) 24%, transparent))
drop-shadow(0 0 10px color-mix(in srgb, var(--color-accent) 24%, transparent));
animation: status-panel-overlay-icon-float 2.4s ease-in-out infinite;
}
@@ -663,15 +769,16 @@
height: 4px;
overflow: hidden;
border-radius: 999px;
background: rgba(111, 140, 255, 0.14);
border: 1px solid var(--color-border-subtle);
background: color-mix(in srgb, var(--color-primary) 12%, var(--color-surface-dim));
}
.status-panel-overlay-bar span {
position: absolute;
inset: 0;
width: 46%;
border-radius: inherit;
background: linear-gradient(90deg, transparent, #6f8cff 40%, #4db6d6 74%, transparent);
box-shadow: 0 0 12px rgba(77, 182, 214, 0.26);
background: linear-gradient(90deg, transparent, var(--color-primary) 40%, var(--color-accent) 74%, transparent);
box-shadow: 0 0 12px color-mix(in srgb, var(--color-accent) 32%, transparent);
animation: status-panel-overlay-bar-slide 1.35s ease-in-out infinite;
}
+13 -14
View File
@@ -53,7 +53,7 @@
);
const versionLabel = $derived(
version && currentVersion
? `${currentVersion} -> ${version}`
? `${currentVersion} ${version}`
: version
? `Version ${version}`
: "New version",
@@ -69,24 +69,21 @@
role={state === "error" ? "alert" : "status"}
aria-live={state === "error" ? "assertive" : "polite"}
>
<div class="update-toast-glow" aria-hidden="true"></div>
<header class="update-toast-header">
<div class="update-toast-icon" class:busy={isBusy}>
{#if state === "downloading"}
<LoaderCircle class="spin" size={21} aria-hidden="true" />
<LoaderCircle class="spin" size={18} aria-hidden="true" />
{:else if state === "installed"}
<PackageCheck size={21} aria-hidden="true" />
<PackageCheck size={18} aria-hidden="true" />
{:else if state === "error"}
<AlertCircle size={21} aria-hidden="true" />
<AlertCircle size={18} aria-hidden="true" />
{:else}
<Sparkles size={21} aria-hidden="true" />
<Sparkles size={18} aria-hidden="true" />
{/if}
</div>
<div class="update-toast-content">
<div class="update-toast-top">
<div class="update-toast-copy">
<span class="update-toast-kicker">{versionLabel}</span>
<span class="update-toast-kicker">Gitty update · {versionLabel}</span>
<h2>{title}</h2>
</div>
@@ -95,8 +92,9 @@
<X size={15} aria-hidden="true" />
</button>
{/if}
</div>
</header>
<div class="update-toast-body">
<p>{description}</p>
{#if showProgress}
@@ -115,7 +113,9 @@
</div>
{/if}
<div class="update-toast-actions">
</div>
<footer class="update-toast-actions">
{#if state === "installed"}
<button class="update-toast-secondary" type="button" onclick={onDismiss}>
Got it
@@ -142,6 +142,5 @@
{/if}
</button>
{/if}
</div>
</div>
</footer>
</section>
+33 -19
View File
@@ -3,9 +3,7 @@ import { tracedInvoke as invoke } from "./telemetry";
import type {
AiReviewResult,
AiCommitPlan,
CommitAiLocalProfile,
CommitAiProvider,
CommitAiStatus,
ConflictFile,
DetectedExternalTool,
ExternalToolCommand,
@@ -14,6 +12,9 @@ import type {
GitBranch,
GitCommit,
GitCommitComparison,
GitIgnoreKind,
GitIntegrationProvider,
GitIntegrationRepository,
GitLfsStatus,
GitRepositoryFile,
GitRemote,
@@ -27,7 +28,6 @@ import type {
GitStatus,
GitTag,
GitWorktree,
LocalModelOption,
PatchApplyAction,
RepositoryBundle,
StoredCredential,
@@ -53,6 +53,10 @@ export function detectExternalTools(): Promise<DetectedExternalTool[]> {
return invoke<DetectedExternalTool[]>("detect_external_tools");
}
export function listIntegrationRepositories(provider: GitIntegrationProvider, baseUrl: string, accountId?: string): Promise<GitIntegrationRepository[]> {
return invoke<GitIntegrationRepository[]>("list_integration_repositories", { provider, baseUrl, accountId: accountId ?? null });
}
export function launchExternalTool(path: string, command: ExternalToolCommand, file?: string): Promise<void> {
return invoke<void>("launch_external_tool", { path, file: file ?? null, command });
}
@@ -291,6 +295,14 @@ export function unstageFiles(path: string, files: string[]): Promise<GitStatus>
return invoke<GitStatus>("unstage_files", { path, files });
}
export function addToGitignore(path: string, target: string, kind: GitIgnoreKind): Promise<GitStatus> {
return invoke<GitStatus>("add_to_gitignore", { path, target, kind });
}
export function untrackPaths(path: string, targets: string[]): Promise<GitStatus> {
return invoke<GitStatus>("untrack_paths", { path, targets });
}
export function restoreFiles(
path: string,
files: string[],
@@ -354,22 +366,9 @@ export function stashDrop(path: string, selector: string): Promise<GitStatus> {
return invoke<GitStatus>("stash_drop", { path, selector });
}
export function commitAiStatus(): Promise<CommitAiStatus> {
return invoke<CommitAiStatus>("commit_ai_status");
}
export function commitAiLoad(modelId: string): Promise<void> {
return invoke<void>("commit_ai_load", { modelId });
}
export function commitAiLocalModels(): Promise<LocalModelOption[]> {
return invoke<LocalModelOption[]>("commit_ai_local_models");
}
export interface CommitAiGenerateOptions {
notes?: string;
provider: CommitAiProvider;
localProfile?: CommitAiLocalProfile;
model?: string;
apiKey?: string;
baseUrl?: string;
@@ -380,7 +379,6 @@ export function commitAiGenerate(path: string, options: CommitAiGenerateOptions)
path,
notes: options.notes,
provider: options.provider,
localProfile: options.localProfile,
model: options.model,
apiKey: options.apiKey,
baseUrl: options.baseUrl,
@@ -407,8 +405,24 @@ export function commitAiSplit(path: string, options: CommitAiGenerateOptions): P
});
}
export function pull(path: string, username?: string, password?: string, strategy: PullStrategy = "merge", remote?: string, branch?: string): Promise<GitStatus> {
return invoke<GitStatus>("pull", { path, username: username ?? null, password: password ?? null, strategy, remote: remote || null, branch: branch || null });
export function pull(
path: string,
username?: string,
password?: string,
strategy: PullStrategy = "merge",
remote?: string,
branch?: string,
allowUnrelatedHistories = false,
): Promise<GitStatus> {
return invoke<GitStatus>("pull", {
path,
username: username ?? null,
password: password ?? null,
strategy,
remote: remote || null,
branch: branch || null,
allowUnrelatedHistories,
});
}
export function fetchRemote(path: string, username?: string, password?: string, prune = false, remote?: string): Promise<GitStatus> {
+169
View File
@@ -0,0 +1,169 @@
import type {
AzureDevOpsOrganization,
GitIntegrationConfig,
GitIntegrationProvider,
GitIntegrationSource,
GitIntegrationSettings,
} from "./types";
export const gitIntegrationProviders: GitIntegrationProvider[] = [
"github",
"gitlab",
"gitlab-self-hosted",
"azure-devops",
"gitea",
];
const defaults: Record<GitIntegrationProvider, Omit<GitIntegrationConfig, "provider">> = {
github: {
enabled: false,
baseUrl: "https://github.com",
username: "",
tokenStored: false,
},
gitlab: {
enabled: false,
baseUrl: "https://gitlab.com",
username: "",
tokenStored: false,
},
"gitlab-self-hosted": {
enabled: false,
baseUrl: "",
username: "",
tokenStored: false,
},
"azure-devops": {
enabled: false,
baseUrl: "https://dev.azure.com/",
username: "",
tokenStored: false,
},
gitea: {
enabled: false,
baseUrl: "",
username: "",
tokenStored: false,
},
};
export function defaultGitIntegrationSettings(): GitIntegrationSettings {
return {
providers: Object.fromEntries(
gitIntegrationProviders.map((provider) => [provider, { provider, ...defaults[provider] }]),
) as GitIntegrationSettings["providers"],
azureDevOpsOrganizations: [],
};
}
function normaliseAzureOrganization(value: unknown): AzureDevOpsOrganization | null {
if (!value || typeof value !== "object") return null;
const stored = value as Partial<AzureDevOpsOrganization>;
const id = typeof stored.id === "string" && /^[a-zA-Z0-9_-]{1,80}$/.test(stored.id) ? stored.id : "";
if (!id) return null;
return {
id,
name: typeof stored.name === "string" ? stored.name : "",
enabled: stored.enabled === true,
baseUrl: typeof stored.baseUrl === "string" ? stored.baseUrl : "",
username: typeof stored.username === "string" ? stored.username : "",
tokenStored: stored.tokenStored === true,
};
}
export function normaliseGitIntegrationSettings(value: unknown): GitIntegrationSettings {
const fallback = defaultGitIntegrationSettings();
if (!value || typeof value !== "object") return fallback;
const storedProviders = (value as Partial<GitIntegrationSettings>).providers;
if (!storedProviders || typeof storedProviders !== "object") return fallback;
for (const provider of gitIntegrationProviders) {
const stored = storedProviders[provider] as Partial<GitIntegrationConfig> | undefined;
if (!stored || typeof stored !== "object") continue;
fallback.providers[provider] = {
provider,
enabled: stored.enabled === true,
baseUrl: typeof stored.baseUrl === "string" ? stored.baseUrl : fallback.providers[provider].baseUrl,
username: typeof stored.username === "string" ? stored.username : "",
tokenStored: stored.tokenStored === true,
};
}
const storedOrganizations = (value as Partial<GitIntegrationSettings>).azureDevOpsOrganizations;
if (Array.isArray(storedOrganizations)) {
const seen = new Set<string>();
fallback.azureDevOpsOrganizations = storedOrganizations
.map(normaliseAzureOrganization)
.filter((organization): organization is AzureDevOpsOrganization => {
if (!organization || seen.has(organization.id)) return false;
seen.add(organization.id);
return true;
});
} else {
const legacy = fallback.providers["azure-devops"];
const hasLegacyConfiguration = legacy.enabled || legacy.tokenStored || legacy.username.trim().length > 0 || !/^https:\/\/dev\.azure\.com\/?$/i.test(legacy.baseUrl.trim());
if (hasLegacyConfiguration) {
fallback.azureDevOpsOrganizations = [{
id: "default",
name: "Azure DevOps",
enabled: legacy.enabled,
baseUrl: legacy.baseUrl,
username: legacy.username,
tokenStored: legacy.tokenStored,
}];
}
}
return fallback;
}
export function integrationCredentialKey(provider: GitIntegrationProvider, accountId?: string): string {
if (provider === "azure-devops" && accountId && accountId !== "default") {
return `integration:${provider}:${accountId}`;
}
return `integration:${provider}`;
}
export function configuredIntegrationSources(settings: GitIntegrationSettings): GitIntegrationSource[] {
const sources: GitIntegrationSource[] = [];
for (const provider of gitIntegrationProviders) {
if (provider === "azure-devops") continue;
const config = settings.providers[provider];
if (config.enabled && config.tokenStored && config.baseUrl.trim()) {
sources.push({ id: provider, provider, label: providerLabel(provider), baseUrl: config.baseUrl });
}
}
for (const organization of settings.azureDevOpsOrganizations) {
if (!organization.enabled || !organization.tokenStored || !organization.baseUrl.trim()) continue;
sources.push({
id: `azure-devops:${organization.id}`,
provider: "azure-devops",
accountId: organization.id,
label: organization.name.trim() || organizationNameFromUrl(organization.baseUrl) || "Azure DevOps",
baseUrl: organization.baseUrl,
});
}
return sources;
}
export function configuredIntegrationCount(settings: GitIntegrationSettings): number {
return configuredIntegrationSources(settings).length;
}
export function providerLabel(provider: GitIntegrationProvider): string {
return {
github: "GitHub",
gitlab: "GitLab.com",
"gitlab-self-hosted": "GitLab Self-Managed",
"azure-devops": "Azure DevOps",
gitea: "Gitea",
}[provider];
}
export function organizationNameFromUrl(value: string): string {
try {
const url = new URL(value);
return url.pathname.split("/").filter(Boolean)[0] ?? "";
} catch {
return "";
}
}
+61 -15
View File
@@ -7,16 +7,69 @@ export type FileStatusKind =
| "conflicted"
| "unknown";
export type CommitAiPhase = "idle" | "loading" | "ready" | "error";
export type CommitAiProvider = "local" | "openai" | "anthropic" | "custom";
export type CommitAiLocalProfile = "fast" | "balanced" | "detailed";
export type GitIgnoreKind = "file" | "extension" | "folder";
export type CommitAiProvider = "openai" | "anthropic" | "custom";
export type AppTheme = "system" | "light" | "dark";
export type AppAppearance = "modern" | "classic" | "custom";
export type AppLanguage = "en" | "de";
export interface CommitAiStatus {
phase: CommitAiPhase;
model_id: string | null;
error: string | null;
export type GitIntegrationProvider = "github" | "gitlab" | "gitlab-self-hosted" | "azure-devops" | "gitea";
export interface GitIntegrationConfig {
provider: GitIntegrationProvider;
enabled: boolean;
baseUrl: string;
username: string;
tokenStored: boolean;
}
export interface GitIntegrationSettings {
providers: Record<GitIntegrationProvider, GitIntegrationConfig>;
azureDevOpsOrganizations: AzureDevOpsOrganization[];
}
export interface AzureDevOpsOrganization {
id: string;
name: string;
enabled: boolean;
baseUrl: string;
username: string;
tokenStored: boolean;
}
export interface GitIntegrationSecretUpdate {
provider: GitIntegrationProvider;
accountId?: string;
token?: string;
removeToken?: boolean;
}
export interface GitIntegrationSource {
id: string;
provider: GitIntegrationProvider;
accountId?: string;
label: string;
baseUrl: string;
}
export interface GitIntegrationRepository {
id: string;
name: string;
fullName: string;
description: string;
cloneUrl: string;
sshUrl: string;
webUrl: string;
updatedAt: string;
private: boolean;
}
export interface CustomThemeColors {
background: string;
surface: string;
accent: string;
text: string;
}
export type AiReviewRisk = "low" | "medium" | "high";
@@ -48,16 +101,8 @@ export interface AiCommitPlan {
groups: AiCommitGroup[];
}
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;
@@ -228,6 +273,7 @@ export interface RepositoryBundle {
stashes: GitStash[];
commits: GitCommit[];
files: GitRepositoryFile[];
warning: string | null;
}
export interface GitDiffFile {