@fuad24/gitbridge 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +223 -0
  3. package/dist/bin/gb.js +3275 -0
  4. package/dist/bin/gitbridge.js +3275 -0
  5. package/dist/cli/commands/account.d.ts +3 -0
  6. package/dist/cli/commands/auth.d.ts +7 -0
  7. package/dist/cli/commands/context.d.ts +2 -0
  8. package/dist/cli/commands/credential.d.ts +18 -0
  9. package/dist/cli/commands/doctor.d.ts +2 -0
  10. package/dist/cli/commands/enable.d.ts +3 -0
  11. package/dist/cli/commands/hook.d.ts +1 -0
  12. package/dist/cli/commands/identity.d.ts +11 -0
  13. package/dist/cli/commands/provider.d.ts +1 -0
  14. package/dist/cli/commands/push.d.ts +5 -0
  15. package/dist/cli/commands/remote.d.ts +5 -0
  16. package/dist/cli/commands/repo.d.ts +2 -0
  17. package/dist/cli/commands/rule.d.ts +8 -0
  18. package/dist/cli/commands/setup.d.ts +2 -0
  19. package/dist/cli/commands/status.d.ts +2 -0
  20. package/dist/cli/commands/switch.d.ts +4 -0
  21. package/dist/cli/index.d.ts +2 -0
  22. package/dist/cli/ui/banners.d.ts +2 -0
  23. package/dist/cli/ui/prompts.d.ts +31 -0
  24. package/dist/cli/ui/tables.d.ts +6 -0
  25. package/dist/core/config/config-store.d.ts +56 -0
  26. package/dist/core/config/path-resolver.d.ts +20 -0
  27. package/dist/core/config/schema.d.ts +461 -0
  28. package/dist/core/git/config-generator.d.ts +12 -0
  29. package/dist/core/git/git-cli.d.ts +32 -0
  30. package/dist/core/git/gitconfig-injector.d.ts +14 -0
  31. package/dist/core/git/url-parser.d.ts +16 -0
  32. package/dist/core/identity/identity-resolver.d.ts +23 -0
  33. package/dist/core/providers/bitbucket.provider.d.ts +12 -0
  34. package/dist/core/providers/github.provider.d.ts +15 -0
  35. package/dist/core/providers/gitlab.provider.d.ts +12 -0
  36. package/dist/core/providers/provider-registry.d.ts +11 -0
  37. package/dist/core/providers/provider.interface.d.ts +50 -0
  38. package/dist/core/safety/identity-guard.d.ts +18 -0
  39. package/dist/core/ssh/ssh-config-generator.d.ts +6 -0
  40. package/dist/core/ssh/ssh-injector.d.ts +14 -0
  41. package/dist/core/ssh/ssh-key-detector.d.ts +10 -0
  42. package/dist/core/storage/credential-store.d.ts +7 -0
  43. package/dist/core/storage/encrypted-vault.d.ts +16 -0
  44. package/dist/core/storage/linux-keyring.d.ts +8 -0
  45. package/dist/core/storage/macos-keychain.d.ts +8 -0
  46. package/dist/core/storage/store-factory.d.ts +5 -0
  47. package/dist/core/storage/windows-cred.d.ts +9 -0
  48. package/dist/index.d.ts +20 -0
  49. package/dist/index.js +3356 -0
  50. package/dist/index.js.map +7 -0
  51. package/dist/utils/errors.d.ts +22 -0
  52. package/dist/utils/http.d.ts +10 -0
  53. package/dist/utils/logger.d.ts +15 -0
  54. package/dist/utils/platform.d.ts +8 -0
  55. package/package.json +62 -0
@@ -0,0 +1,461 @@
1
+ import { z } from "zod";
2
+ export declare const GitProviderTypeSchema: z.ZodEnum<["github", "gitlab", "bitbucket", "gitea", "custom"]>;
3
+ export type GitProviderType = z.infer<typeof GitProviderTypeSchema>;
4
+ export declare const AuthTypeSchema: z.ZodEnum<["oauth", "pat", "ssh", "password"]>;
5
+ export type AuthType = z.infer<typeof AuthTypeSchema>;
6
+ export declare const GitIdentitySchema: z.ZodObject<{
7
+ id: z.ZodString;
8
+ name: z.ZodString;
9
+ email: z.ZodString;
10
+ signingKey: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
11
+ isDefault: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
12
+ createdAt: z.ZodDefault<z.ZodOptional<z.ZodString>>;
13
+ }, "strip", z.ZodTypeAny, {
14
+ id: string;
15
+ name: string;
16
+ email: string;
17
+ signingKey: string | null;
18
+ isDefault: boolean;
19
+ createdAt: string;
20
+ }, {
21
+ id: string;
22
+ name: string;
23
+ email: string;
24
+ signingKey?: string | null | undefined;
25
+ isDefault?: boolean | undefined;
26
+ createdAt?: string | undefined;
27
+ }>;
28
+ export type GitIdentity = z.infer<typeof GitIdentitySchema>;
29
+ export declare const IdentitiesFileSchema: z.ZodObject<{
30
+ identities: z.ZodDefault<z.ZodArray<z.ZodObject<{
31
+ id: z.ZodString;
32
+ name: z.ZodString;
33
+ email: z.ZodString;
34
+ signingKey: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
35
+ isDefault: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
36
+ createdAt: z.ZodDefault<z.ZodOptional<z.ZodString>>;
37
+ }, "strip", z.ZodTypeAny, {
38
+ id: string;
39
+ name: string;
40
+ email: string;
41
+ signingKey: string | null;
42
+ isDefault: boolean;
43
+ createdAt: string;
44
+ }, {
45
+ id: string;
46
+ name: string;
47
+ email: string;
48
+ signingKey?: string | null | undefined;
49
+ isDefault?: boolean | undefined;
50
+ createdAt?: string | undefined;
51
+ }>, "many">>;
52
+ }, "strip", z.ZodTypeAny, {
53
+ identities: {
54
+ id: string;
55
+ name: string;
56
+ email: string;
57
+ signingKey: string | null;
58
+ isDefault: boolean;
59
+ createdAt: string;
60
+ }[];
61
+ }, {
62
+ identities?: {
63
+ id: string;
64
+ name: string;
65
+ email: string;
66
+ signingKey?: string | null | undefined;
67
+ isDefault?: boolean | undefined;
68
+ createdAt?: string | undefined;
69
+ }[] | undefined;
70
+ }>;
71
+ export type IdentitiesFile = z.infer<typeof IdentitiesFileSchema>;
72
+ export declare const ProviderAccountSchema: z.ZodObject<{
73
+ id: z.ZodString;
74
+ providerId: z.ZodEnum<["github", "gitlab", "bitbucket", "gitea", "custom"]>;
75
+ host: z.ZodString;
76
+ username: z.ZodString;
77
+ displayName: z.ZodOptional<z.ZodString>;
78
+ authType: z.ZodEnum<["oauth", "pat", "ssh", "password"]>;
79
+ sshKeyPath: z.ZodOptional<z.ZodString>;
80
+ createdAt: z.ZodDefault<z.ZodOptional<z.ZodString>>;
81
+ }, "strip", z.ZodTypeAny, {
82
+ id: string;
83
+ createdAt: string;
84
+ providerId: "github" | "gitlab" | "bitbucket" | "gitea" | "custom";
85
+ host: string;
86
+ username: string;
87
+ authType: "oauth" | "pat" | "ssh" | "password";
88
+ displayName?: string | undefined;
89
+ sshKeyPath?: string | undefined;
90
+ }, {
91
+ id: string;
92
+ providerId: "github" | "gitlab" | "bitbucket" | "gitea" | "custom";
93
+ host: string;
94
+ username: string;
95
+ authType: "oauth" | "pat" | "ssh" | "password";
96
+ createdAt?: string | undefined;
97
+ displayName?: string | undefined;
98
+ sshKeyPath?: string | undefined;
99
+ }>;
100
+ export type ProviderAccount = z.infer<typeof ProviderAccountSchema>;
101
+ export declare const AccountsFileSchema: z.ZodObject<{
102
+ accounts: z.ZodDefault<z.ZodArray<z.ZodObject<{
103
+ id: z.ZodString;
104
+ providerId: z.ZodEnum<["github", "gitlab", "bitbucket", "gitea", "custom"]>;
105
+ host: z.ZodString;
106
+ username: z.ZodString;
107
+ displayName: z.ZodOptional<z.ZodString>;
108
+ authType: z.ZodEnum<["oauth", "pat", "ssh", "password"]>;
109
+ sshKeyPath: z.ZodOptional<z.ZodString>;
110
+ createdAt: z.ZodDefault<z.ZodOptional<z.ZodString>>;
111
+ }, "strip", z.ZodTypeAny, {
112
+ id: string;
113
+ createdAt: string;
114
+ providerId: "github" | "gitlab" | "bitbucket" | "gitea" | "custom";
115
+ host: string;
116
+ username: string;
117
+ authType: "oauth" | "pat" | "ssh" | "password";
118
+ displayName?: string | undefined;
119
+ sshKeyPath?: string | undefined;
120
+ }, {
121
+ id: string;
122
+ providerId: "github" | "gitlab" | "bitbucket" | "gitea" | "custom";
123
+ host: string;
124
+ username: string;
125
+ authType: "oauth" | "pat" | "ssh" | "password";
126
+ createdAt?: string | undefined;
127
+ displayName?: string | undefined;
128
+ sshKeyPath?: string | undefined;
129
+ }>, "many">>;
130
+ }, "strip", z.ZodTypeAny, {
131
+ accounts: {
132
+ id: string;
133
+ createdAt: string;
134
+ providerId: "github" | "gitlab" | "bitbucket" | "gitea" | "custom";
135
+ host: string;
136
+ username: string;
137
+ authType: "oauth" | "pat" | "ssh" | "password";
138
+ displayName?: string | undefined;
139
+ sshKeyPath?: string | undefined;
140
+ }[];
141
+ }, {
142
+ accounts?: {
143
+ id: string;
144
+ providerId: "github" | "gitlab" | "bitbucket" | "gitea" | "custom";
145
+ host: string;
146
+ username: string;
147
+ authType: "oauth" | "pat" | "ssh" | "password";
148
+ createdAt?: string | undefined;
149
+ displayName?: string | undefined;
150
+ sshKeyPath?: string | undefined;
151
+ }[] | undefined;
152
+ }>;
153
+ export type AccountsFile = z.infer<typeof AccountsFileSchema>;
154
+ export declare const DirectoryRuleSchema: z.ZodObject<{
155
+ id: z.ZodString;
156
+ path: z.ZodString;
157
+ identityId: z.ZodString;
158
+ defaultProvider: z.ZodOptional<z.ZodEnum<["github", "gitlab", "bitbucket", "gitea", "custom"]>>;
159
+ defaultAccountId: z.ZodOptional<z.ZodString>;
160
+ }, "strip", z.ZodTypeAny, {
161
+ path: string;
162
+ id: string;
163
+ identityId: string;
164
+ defaultProvider?: "github" | "gitlab" | "bitbucket" | "gitea" | "custom" | undefined;
165
+ defaultAccountId?: string | undefined;
166
+ }, {
167
+ path: string;
168
+ id: string;
169
+ identityId: string;
170
+ defaultProvider?: "github" | "gitlab" | "bitbucket" | "gitea" | "custom" | undefined;
171
+ defaultAccountId?: string | undefined;
172
+ }>;
173
+ export type DirectoryRule = z.infer<typeof DirectoryRuleSchema>;
174
+ export declare const GitBridgeSettingsSchema: z.ZodObject<{
175
+ autoSyncGitConfig: z.ZodDefault<z.ZodBoolean>;
176
+ credentialHelperEnabled: z.ZodDefault<z.ZodBoolean>;
177
+ sshManagementEnabled: z.ZodDefault<z.ZodBoolean>;
178
+ commitIdentitySafety: z.ZodDefault<z.ZodBoolean>;
179
+ fallbackEncryptedStore: z.ZodDefault<z.ZodBoolean>;
180
+ }, "strip", z.ZodTypeAny, {
181
+ autoSyncGitConfig: boolean;
182
+ credentialHelperEnabled: boolean;
183
+ sshManagementEnabled: boolean;
184
+ commitIdentitySafety: boolean;
185
+ fallbackEncryptedStore: boolean;
186
+ }, {
187
+ autoSyncGitConfig?: boolean | undefined;
188
+ credentialHelperEnabled?: boolean | undefined;
189
+ sshManagementEnabled?: boolean | undefined;
190
+ commitIdentitySafety?: boolean | undefined;
191
+ fallbackEncryptedStore?: boolean | undefined;
192
+ }>;
193
+ export type GitBridgeSettings = z.infer<typeof GitBridgeSettingsSchema>;
194
+ export declare const MainConfigSchema: z.ZodObject<{
195
+ $schema: z.ZodOptional<z.ZodString>;
196
+ version: z.ZodDefault<z.ZodString>;
197
+ enabled: z.ZodDefault<z.ZodBoolean>;
198
+ defaultIdentityId: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
199
+ rules: z.ZodDefault<z.ZodArray<z.ZodObject<{
200
+ id: z.ZodString;
201
+ path: z.ZodString;
202
+ identityId: z.ZodString;
203
+ defaultProvider: z.ZodOptional<z.ZodEnum<["github", "gitlab", "bitbucket", "gitea", "custom"]>>;
204
+ defaultAccountId: z.ZodOptional<z.ZodString>;
205
+ }, "strip", z.ZodTypeAny, {
206
+ path: string;
207
+ id: string;
208
+ identityId: string;
209
+ defaultProvider?: "github" | "gitlab" | "bitbucket" | "gitea" | "custom" | undefined;
210
+ defaultAccountId?: string | undefined;
211
+ }, {
212
+ path: string;
213
+ id: string;
214
+ identityId: string;
215
+ defaultProvider?: "github" | "gitlab" | "bitbucket" | "gitea" | "custom" | undefined;
216
+ defaultAccountId?: string | undefined;
217
+ }>, "many">>;
218
+ settings: z.ZodDefault<z.ZodObject<{
219
+ autoSyncGitConfig: z.ZodDefault<z.ZodBoolean>;
220
+ credentialHelperEnabled: z.ZodDefault<z.ZodBoolean>;
221
+ sshManagementEnabled: z.ZodDefault<z.ZodBoolean>;
222
+ commitIdentitySafety: z.ZodDefault<z.ZodBoolean>;
223
+ fallbackEncryptedStore: z.ZodDefault<z.ZodBoolean>;
224
+ }, "strip", z.ZodTypeAny, {
225
+ autoSyncGitConfig: boolean;
226
+ credentialHelperEnabled: boolean;
227
+ sshManagementEnabled: boolean;
228
+ commitIdentitySafety: boolean;
229
+ fallbackEncryptedStore: boolean;
230
+ }, {
231
+ autoSyncGitConfig?: boolean | undefined;
232
+ credentialHelperEnabled?: boolean | undefined;
233
+ sshManagementEnabled?: boolean | undefined;
234
+ commitIdentitySafety?: boolean | undefined;
235
+ fallbackEncryptedStore?: boolean | undefined;
236
+ }>>;
237
+ }, "strip", z.ZodTypeAny, {
238
+ version: string;
239
+ enabled: boolean;
240
+ defaultIdentityId: string | null;
241
+ rules: {
242
+ path: string;
243
+ id: string;
244
+ identityId: string;
245
+ defaultProvider?: "github" | "gitlab" | "bitbucket" | "gitea" | "custom" | undefined;
246
+ defaultAccountId?: string | undefined;
247
+ }[];
248
+ settings: {
249
+ autoSyncGitConfig: boolean;
250
+ credentialHelperEnabled: boolean;
251
+ sshManagementEnabled: boolean;
252
+ commitIdentitySafety: boolean;
253
+ fallbackEncryptedStore: boolean;
254
+ };
255
+ $schema?: string | undefined;
256
+ }, {
257
+ $schema?: string | undefined;
258
+ version?: string | undefined;
259
+ enabled?: boolean | undefined;
260
+ defaultIdentityId?: string | null | undefined;
261
+ rules?: {
262
+ path: string;
263
+ id: string;
264
+ identityId: string;
265
+ defaultProvider?: "github" | "gitlab" | "bitbucket" | "gitea" | "custom" | undefined;
266
+ defaultAccountId?: string | undefined;
267
+ }[] | undefined;
268
+ settings?: {
269
+ autoSyncGitConfig?: boolean | undefined;
270
+ credentialHelperEnabled?: boolean | undefined;
271
+ sshManagementEnabled?: boolean | undefined;
272
+ commitIdentitySafety?: boolean | undefined;
273
+ fallbackEncryptedStore?: boolean | undefined;
274
+ } | undefined;
275
+ }>;
276
+ export type MainConfig = z.infer<typeof MainConfigSchema>;
277
+ export declare const RepositoryRemoteSchema: z.ZodObject<{
278
+ name: z.ZodString;
279
+ providerId: z.ZodEnum<["github", "gitlab", "bitbucket", "gitea", "custom"]>;
280
+ host: z.ZodString;
281
+ accountId: z.ZodOptional<z.ZodString>;
282
+ url: z.ZodString;
283
+ rawUrl: z.ZodOptional<z.ZodString>;
284
+ }, "strip", z.ZodTypeAny, {
285
+ name: string;
286
+ providerId: "github" | "gitlab" | "bitbucket" | "gitea" | "custom";
287
+ host: string;
288
+ url: string;
289
+ accountId?: string | undefined;
290
+ rawUrl?: string | undefined;
291
+ }, {
292
+ name: string;
293
+ providerId: "github" | "gitlab" | "bitbucket" | "gitea" | "custom";
294
+ host: string;
295
+ url: string;
296
+ accountId?: string | undefined;
297
+ rawUrl?: string | undefined;
298
+ }>;
299
+ export type RepositoryRemote = z.infer<typeof RepositoryRemoteSchema>;
300
+ export declare const RepositoryProfileSchema: z.ZodObject<{
301
+ path: z.ZodString;
302
+ identityId: z.ZodOptional<z.ZodString>;
303
+ remotes: z.ZodDefault<z.ZodArray<z.ZodObject<{
304
+ name: z.ZodString;
305
+ providerId: z.ZodEnum<["github", "gitlab", "bitbucket", "gitea", "custom"]>;
306
+ host: z.ZodString;
307
+ accountId: z.ZodOptional<z.ZodString>;
308
+ url: z.ZodString;
309
+ rawUrl: z.ZodOptional<z.ZodString>;
310
+ }, "strip", z.ZodTypeAny, {
311
+ name: string;
312
+ providerId: "github" | "gitlab" | "bitbucket" | "gitea" | "custom";
313
+ host: string;
314
+ url: string;
315
+ accountId?: string | undefined;
316
+ rawUrl?: string | undefined;
317
+ }, {
318
+ name: string;
319
+ providerId: "github" | "gitlab" | "bitbucket" | "gitea" | "custom";
320
+ host: string;
321
+ url: string;
322
+ accountId?: string | undefined;
323
+ rawUrl?: string | undefined;
324
+ }>, "many">>;
325
+ safetyHookInstalled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
326
+ updatedAt: z.ZodDefault<z.ZodOptional<z.ZodString>>;
327
+ }, "strip", z.ZodTypeAny, {
328
+ path: string;
329
+ remotes: {
330
+ name: string;
331
+ providerId: "github" | "gitlab" | "bitbucket" | "gitea" | "custom";
332
+ host: string;
333
+ url: string;
334
+ accountId?: string | undefined;
335
+ rawUrl?: string | undefined;
336
+ }[];
337
+ safetyHookInstalled: boolean;
338
+ updatedAt: string;
339
+ identityId?: string | undefined;
340
+ }, {
341
+ path: string;
342
+ identityId?: string | undefined;
343
+ remotes?: {
344
+ name: string;
345
+ providerId: "github" | "gitlab" | "bitbucket" | "gitea" | "custom";
346
+ host: string;
347
+ url: string;
348
+ accountId?: string | undefined;
349
+ rawUrl?: string | undefined;
350
+ }[] | undefined;
351
+ safetyHookInstalled?: boolean | undefined;
352
+ updatedAt?: string | undefined;
353
+ }>;
354
+ export type RepositoryProfile = z.infer<typeof RepositoryProfileSchema>;
355
+ export declare const RepositoriesFileSchema: z.ZodObject<{
356
+ repositories: z.ZodDefault<z.ZodArray<z.ZodObject<{
357
+ path: z.ZodString;
358
+ identityId: z.ZodOptional<z.ZodString>;
359
+ remotes: z.ZodDefault<z.ZodArray<z.ZodObject<{
360
+ name: z.ZodString;
361
+ providerId: z.ZodEnum<["github", "gitlab", "bitbucket", "gitea", "custom"]>;
362
+ host: z.ZodString;
363
+ accountId: z.ZodOptional<z.ZodString>;
364
+ url: z.ZodString;
365
+ rawUrl: z.ZodOptional<z.ZodString>;
366
+ }, "strip", z.ZodTypeAny, {
367
+ name: string;
368
+ providerId: "github" | "gitlab" | "bitbucket" | "gitea" | "custom";
369
+ host: string;
370
+ url: string;
371
+ accountId?: string | undefined;
372
+ rawUrl?: string | undefined;
373
+ }, {
374
+ name: string;
375
+ providerId: "github" | "gitlab" | "bitbucket" | "gitea" | "custom";
376
+ host: string;
377
+ url: string;
378
+ accountId?: string | undefined;
379
+ rawUrl?: string | undefined;
380
+ }>, "many">>;
381
+ safetyHookInstalled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
382
+ updatedAt: z.ZodDefault<z.ZodOptional<z.ZodString>>;
383
+ }, "strip", z.ZodTypeAny, {
384
+ path: string;
385
+ remotes: {
386
+ name: string;
387
+ providerId: "github" | "gitlab" | "bitbucket" | "gitea" | "custom";
388
+ host: string;
389
+ url: string;
390
+ accountId?: string | undefined;
391
+ rawUrl?: string | undefined;
392
+ }[];
393
+ safetyHookInstalled: boolean;
394
+ updatedAt: string;
395
+ identityId?: string | undefined;
396
+ }, {
397
+ path: string;
398
+ identityId?: string | undefined;
399
+ remotes?: {
400
+ name: string;
401
+ providerId: "github" | "gitlab" | "bitbucket" | "gitea" | "custom";
402
+ host: string;
403
+ url: string;
404
+ accountId?: string | undefined;
405
+ rawUrl?: string | undefined;
406
+ }[] | undefined;
407
+ safetyHookInstalled?: boolean | undefined;
408
+ updatedAt?: string | undefined;
409
+ }>, "many">>;
410
+ }, "strip", z.ZodTypeAny, {
411
+ repositories: {
412
+ path: string;
413
+ remotes: {
414
+ name: string;
415
+ providerId: "github" | "gitlab" | "bitbucket" | "gitea" | "custom";
416
+ host: string;
417
+ url: string;
418
+ accountId?: string | undefined;
419
+ rawUrl?: string | undefined;
420
+ }[];
421
+ safetyHookInstalled: boolean;
422
+ updatedAt: string;
423
+ identityId?: string | undefined;
424
+ }[];
425
+ }, {
426
+ repositories?: {
427
+ path: string;
428
+ identityId?: string | undefined;
429
+ remotes?: {
430
+ name: string;
431
+ providerId: "github" | "gitlab" | "bitbucket" | "gitea" | "custom";
432
+ host: string;
433
+ url: string;
434
+ accountId?: string | undefined;
435
+ rawUrl?: string | undefined;
436
+ }[] | undefined;
437
+ safetyHookInstalled?: boolean | undefined;
438
+ updatedAt?: string | undefined;
439
+ }[] | undefined;
440
+ }>;
441
+ export type RepositoriesFile = z.infer<typeof RepositoriesFileSchema>;
442
+ export declare const CustomProviderSchema: z.ZodObject<{
443
+ id: z.ZodString;
444
+ name: z.ZodString;
445
+ host: z.ZodString;
446
+ type: z.ZodDefault<z.ZodEnum<["github", "gitlab", "bitbucket", "gitea", "custom"]>>;
447
+ apiBaseUrl: z.ZodOptional<z.ZodString>;
448
+ }, "strip", z.ZodTypeAny, {
449
+ type: "github" | "gitlab" | "bitbucket" | "gitea" | "custom";
450
+ id: string;
451
+ name: string;
452
+ host: string;
453
+ apiBaseUrl?: string | undefined;
454
+ }, {
455
+ id: string;
456
+ name: string;
457
+ host: string;
458
+ type?: "github" | "gitlab" | "bitbucket" | "gitea" | "custom" | undefined;
459
+ apiBaseUrl?: string | undefined;
460
+ }>;
461
+ export type CustomProvider = z.infer<typeof CustomProviderSchema>;
@@ -0,0 +1,12 @@
1
+ import { ConfigStore } from "../config/config-store";
2
+ export declare class GitConfigGenerator {
3
+ private store;
4
+ constructor(store: ConfigStore);
5
+ /**
6
+ * Generates all Git configuration files into ~/.gitbridge/generated/
7
+ */
8
+ generate(): {
9
+ mainConfigPath: string;
10
+ generatedRules: string[];
11
+ };
12
+ }
@@ -0,0 +1,32 @@
1
+ import { type ParsedRemoteUrl } from "./url-parser";
2
+ export interface GitExecResult {
3
+ stdout: string;
4
+ stderr: string;
5
+ exitCode: number;
6
+ }
7
+ export interface GitRemoteInfo {
8
+ name: string;
9
+ fetchUrl: string;
10
+ pushUrl: string;
11
+ parsedFetch: ParsedRemoteUrl | null;
12
+ parsedPush: ParsedRemoteUrl | null;
13
+ }
14
+ export declare class GitCli {
15
+ private cwd;
16
+ constructor(cwd?: string);
17
+ getCwd(): string;
18
+ exec(args: string[], options?: {
19
+ cwd?: string;
20
+ allowFailure?: boolean;
21
+ env?: Record<string, string>;
22
+ }): Promise<GitExecResult>;
23
+ isGitRepo(): Promise<boolean>;
24
+ getRepoRoot(): Promise<string | null>;
25
+ getConfig(key: string, scope?: "local" | "global" | "system"): Promise<string | null>;
26
+ setConfig(key: string, value: string, scope?: "local" | "global"): Promise<void>;
27
+ unsetConfig(key: string, scope?: "local" | "global"): Promise<void>;
28
+ getRemotes(): Promise<GitRemoteInfo[]>;
29
+ setRemoteUrl(name: string, url: string): Promise<void>;
30
+ getCurrentBranch(): Promise<string | null>;
31
+ getGitVersion(): Promise<string | null>;
32
+ }
@@ -0,0 +1,14 @@
1
+ import { ConfigStore } from "../config/config-store";
2
+ export declare const GITCONFIG_BLOCK_START = "# --- BEGIN GITBRIDGE MANAGED BLOCK ---";
3
+ export declare const GITCONFIG_BLOCK_END = "# --- END GITBRIDGE MANAGED BLOCK ---";
4
+ export declare class GitConfigInjector {
5
+ private store;
6
+ constructor(store: ConfigStore);
7
+ isInstalled(targetFile?: string): boolean;
8
+ private createBackup;
9
+ inject(targetFile?: string): {
10
+ success: boolean;
11
+ backupPath: string | null;
12
+ };
13
+ remove(targetFile?: string): boolean;
14
+ }
@@ -0,0 +1,16 @@
1
+ import type { GitProviderType } from "../config/schema";
2
+ export interface ParsedRemoteUrl {
3
+ rawUrl: string;
4
+ protocol: "ssh" | "https" | "file" | "unknown";
5
+ providerId: GitProviderType;
6
+ host: string;
7
+ rawHost: string;
8
+ accountAlias?: string;
9
+ owner: string;
10
+ repo: string;
11
+ fullName: string;
12
+ }
13
+ export declare function detectProviderType(host: string): GitProviderType;
14
+ export declare function parseRemoteUrl(url: string): ParsedRemoteUrl | null;
15
+ export declare function buildSshUrl(host: string, owner: string, repo: string, accountId?: string): string;
16
+ export declare function buildHttpsUrl(host: string, owner: string, repo: string): string;
@@ -0,0 +1,23 @@
1
+ import { ConfigStore } from "../config/config-store";
2
+ import { type GitRemoteInfo } from "../git/git-cli";
3
+ import type { GitIdentity, ProviderAccount, DirectoryRule, RepositoryProfile } from "../config/schema";
4
+ export type ResolutionSource = "repo_profile" | "directory_rule" | "global_default" | "system_fallback" | "unconfigured";
5
+ export interface ResolvedContext {
6
+ cwd: string;
7
+ isGitRepo: boolean;
8
+ repoRoot: string | null;
9
+ source: ResolutionSource;
10
+ identity: GitIdentity | null;
11
+ account: ProviderAccount | null;
12
+ matchedRule: DirectoryRule | null;
13
+ repoProfile: RepositoryProfile | null;
14
+ remotes: GitRemoteInfo[];
15
+ localGitEmail: string | null;
16
+ localGitName: string | null;
17
+ isMismatched: boolean;
18
+ }
19
+ export declare class IdentityResolver {
20
+ private store;
21
+ constructor(store: ConfigStore);
22
+ resolve(cwd?: string): Promise<ResolvedContext>;
23
+ }
@@ -0,0 +1,12 @@
1
+ import type { GitProvider, ProviderUser, RemoteRepository, HealthCheckResult } from "./provider.interface";
2
+ export declare class BitbucketProvider implements GitProvider {
3
+ readonly id: "bitbucket";
4
+ readonly name = "Bitbucket";
5
+ readonly defaultHost = "bitbucket.org";
6
+ private getApiUrl;
7
+ private getAuthHeader;
8
+ validateToken(token: string, host?: string): Promise<boolean>;
9
+ getUser(token: string, host?: string): Promise<ProviderUser>;
10
+ listRepositories(token: string, host?: string): Promise<RemoteRepository[]>;
11
+ checkHealth(host?: string): Promise<HealthCheckResult>;
12
+ }
@@ -0,0 +1,15 @@
1
+ import type { GitProvider, ProviderUser, RemoteRepository, HealthCheckResult, DeviceCodeResponse } from "./provider.interface";
2
+ export declare class GitHubProvider implements GitProvider {
3
+ readonly id: "github";
4
+ readonly name = "GitHub";
5
+ readonly defaultHost = "github.com";
6
+ private getApiUrl;
7
+ validateToken(token: string, host?: string): Promise<boolean>;
8
+ getUser(token: string, host?: string): Promise<ProviderUser>;
9
+ listRepositories(token: string, host?: string): Promise<RemoteRepository[]>;
10
+ checkHealth(host?: string): Promise<HealthCheckResult>;
11
+ startDeviceFlow(): Promise<DeviceCodeResponse>;
12
+ pollDeviceFlow(deviceCode: string, interval?: number): Promise<{
13
+ token: string;
14
+ }>;
15
+ }
@@ -0,0 +1,12 @@
1
+ import type { GitProvider, ProviderUser, RemoteRepository, HealthCheckResult } from "./provider.interface";
2
+ export declare class GitLabProvider implements GitProvider {
3
+ readonly id: "gitlab";
4
+ readonly name = "GitLab";
5
+ readonly defaultHost = "gitlab.com";
6
+ private getApiUrl;
7
+ private getAuthHeader;
8
+ validateToken(token: string, host?: string): Promise<boolean>;
9
+ getUser(token: string, host?: string): Promise<ProviderUser>;
10
+ listRepositories(token: string, host?: string): Promise<RemoteRepository[]>;
11
+ checkHealth(host?: string): Promise<HealthCheckResult>;
12
+ }
@@ -0,0 +1,11 @@
1
+ import type { GitProvider } from "./provider.interface";
2
+ import type { GitProviderType } from "../config/schema";
3
+ export declare class ProviderRegistry {
4
+ private providers;
5
+ constructor();
6
+ register(provider: GitProvider): void;
7
+ get(idOrType: GitProviderType | string): GitProvider | undefined;
8
+ getByHost(host: string): GitProvider | undefined;
9
+ list(): GitProvider[];
10
+ }
11
+ export declare const defaultProviderRegistry: ProviderRegistry;
@@ -0,0 +1,50 @@
1
+ import type { GitProviderType } from "../config/schema";
2
+ export interface ProviderUser {
3
+ id: string;
4
+ username: string;
5
+ displayName?: string;
6
+ email?: string;
7
+ avatarUrl?: string;
8
+ }
9
+ export interface RemoteRepository {
10
+ id: string;
11
+ name: string;
12
+ fullName: string;
13
+ sshUrl: string;
14
+ httpsUrl: string;
15
+ isPrivate: boolean;
16
+ defaultBranch: string;
17
+ htmlUrl?: string;
18
+ }
19
+ export interface CreateRepositoryOptions {
20
+ name: string;
21
+ description?: string;
22
+ isPrivate: boolean;
23
+ org?: string;
24
+ }
25
+ export interface HealthCheckResult {
26
+ apiOk: boolean;
27
+ pingMs: number;
28
+ message?: string;
29
+ error?: string;
30
+ }
31
+ export interface DeviceCodeResponse {
32
+ deviceCode: string;
33
+ userCode: string;
34
+ verificationUri: string;
35
+ expiresIn: number;
36
+ interval: number;
37
+ }
38
+ export interface GitProvider {
39
+ readonly id: GitProviderType;
40
+ readonly name: string;
41
+ readonly defaultHost: string;
42
+ validateToken(token: string, host?: string): Promise<boolean>;
43
+ getUser(token: string, host?: string): Promise<ProviderUser>;
44
+ listRepositories(token: string, host?: string): Promise<RemoteRepository[]>;
45
+ checkHealth(host?: string): Promise<HealthCheckResult>;
46
+ startDeviceFlow?(): Promise<DeviceCodeResponse>;
47
+ pollDeviceFlow?(deviceCode: string, interval: number): Promise<{
48
+ token: string;
49
+ }>;
50
+ }