feat(git): add token authentication and credential discovery

Add support for token-based git authentication in identity profiles.
Enable discovery and import of credentials from ~/.git-credentials file.
Introduce remote URL-based filtering for token identities in git view.
This commit is contained in:
btriapitsyn
2026-01-14 02:47:26 +02:00
parent d56eef8aa6
commit fa83c1e645
16 changed files with 704 additions and 44 deletions
+22 -1
View File
@@ -21,7 +21,8 @@ import type {
GitLogResponse,
GitCommitFilesResponse,
GitIdentitySummary,
GitIdentityProfile
GitIdentityProfile,
DiscoveredGitCredential
} from '@openchamber/ui/lib/api/types';
async function safeGitInvoke<T>(command: string, args?: Record<string, unknown>): Promise<T> {
@@ -237,4 +238,24 @@ export const createDesktopGitAPI = (): GitAPI => ({
async deleteGitIdentity(id: string): Promise<void> {
return safeGitInvoke<void>('delete_git_identity', { id });
},
async discoverGitCredentials(): Promise<DiscoveredGitCredential[]> {
return safeGitInvoke<DiscoveredGitCredential[]>('discover_git_credentials');
},
async getGlobalGitIdentity(): Promise<GitIdentitySummary | null> {
try {
return await safeGitInvoke<GitIdentitySummary>('get_global_git_identity');
} catch {
return null;
}
},
async getRemoteUrl(directory: string, remote?: string): Promise<string | null> {
try {
return await safeGitInvoke<string | null>('get_remote_url', { directory, remote });
} catch {
return null;
}
},
});