@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.
- package/LICENSE +21 -0
- package/README.md +223 -0
- package/dist/bin/gb.js +3275 -0
- package/dist/bin/gitbridge.js +3275 -0
- package/dist/cli/commands/account.d.ts +3 -0
- package/dist/cli/commands/auth.d.ts +7 -0
- package/dist/cli/commands/context.d.ts +2 -0
- package/dist/cli/commands/credential.d.ts +18 -0
- package/dist/cli/commands/doctor.d.ts +2 -0
- package/dist/cli/commands/enable.d.ts +3 -0
- package/dist/cli/commands/hook.d.ts +1 -0
- package/dist/cli/commands/identity.d.ts +11 -0
- package/dist/cli/commands/provider.d.ts +1 -0
- package/dist/cli/commands/push.d.ts +5 -0
- package/dist/cli/commands/remote.d.ts +5 -0
- package/dist/cli/commands/repo.d.ts +2 -0
- package/dist/cli/commands/rule.d.ts +8 -0
- package/dist/cli/commands/setup.d.ts +2 -0
- package/dist/cli/commands/status.d.ts +2 -0
- package/dist/cli/commands/switch.d.ts +4 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/ui/banners.d.ts +2 -0
- package/dist/cli/ui/prompts.d.ts +31 -0
- package/dist/cli/ui/tables.d.ts +6 -0
- package/dist/core/config/config-store.d.ts +56 -0
- package/dist/core/config/path-resolver.d.ts +20 -0
- package/dist/core/config/schema.d.ts +461 -0
- package/dist/core/git/config-generator.d.ts +12 -0
- package/dist/core/git/git-cli.d.ts +32 -0
- package/dist/core/git/gitconfig-injector.d.ts +14 -0
- package/dist/core/git/url-parser.d.ts +16 -0
- package/dist/core/identity/identity-resolver.d.ts +23 -0
- package/dist/core/providers/bitbucket.provider.d.ts +12 -0
- package/dist/core/providers/github.provider.d.ts +15 -0
- package/dist/core/providers/gitlab.provider.d.ts +12 -0
- package/dist/core/providers/provider-registry.d.ts +11 -0
- package/dist/core/providers/provider.interface.d.ts +50 -0
- package/dist/core/safety/identity-guard.d.ts +18 -0
- package/dist/core/ssh/ssh-config-generator.d.ts +6 -0
- package/dist/core/ssh/ssh-injector.d.ts +14 -0
- package/dist/core/ssh/ssh-key-detector.d.ts +10 -0
- package/dist/core/storage/credential-store.d.ts +7 -0
- package/dist/core/storage/encrypted-vault.d.ts +16 -0
- package/dist/core/storage/linux-keyring.d.ts +8 -0
- package/dist/core/storage/macos-keychain.d.ts +8 -0
- package/dist/core/storage/store-factory.d.ts +5 -0
- package/dist/core/storage/windows-cred.d.ts +9 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +3356 -0
- package/dist/index.js.map +7 -0
- package/dist/utils/errors.d.ts +22 -0
- package/dist/utils/http.d.ts +10 -0
- package/dist/utils/logger.d.ts +15 -0
- package/dist/utils/platform.d.ts +8 -0
- package/package.json +62 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ConfigStore } from "@/core/config/config-store";
|
|
2
|
+
export declare function handleAuthLogin(providerName?: string, options?: {
|
|
3
|
+
token?: string;
|
|
4
|
+
host?: string;
|
|
5
|
+
sshKey?: string;
|
|
6
|
+
}, store?: ConfigStore): Promise<void>;
|
|
7
|
+
export declare function handleAuthLogout(providerName: string, username?: string, store?: ConfigStore): Promise<void>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ConfigStore } from "@/core/config/config-store";
|
|
2
|
+
export interface GitCredentialPayload {
|
|
3
|
+
protocol?: string;
|
|
4
|
+
host?: string;
|
|
5
|
+
path?: string;
|
|
6
|
+
username?: string;
|
|
7
|
+
password?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function parseGitCredentialInput(raw: string): GitCredentialPayload;
|
|
10
|
+
export declare class GitCredentialHelperHandler {
|
|
11
|
+
private store;
|
|
12
|
+
private resolver;
|
|
13
|
+
constructor(store?: ConfigStore);
|
|
14
|
+
handleGet(input: string, cwd?: string): Promise<string>;
|
|
15
|
+
handleStore(input: string): Promise<void>;
|
|
16
|
+
handleErase(input: string): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export declare function handleCredentialCommand(action: "get" | "store" | "erase", stdinData?: string): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function handleHookCommand(hookType: string): Promise<void>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ConfigStore } from "@/core/config/config-store";
|
|
2
|
+
export declare function handleIdentityList(store?: ConfigStore): Promise<void>;
|
|
3
|
+
export declare function handleIdentityAdd(options?: {
|
|
4
|
+
id?: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
email?: string;
|
|
7
|
+
signingKey?: string;
|
|
8
|
+
default?: boolean;
|
|
9
|
+
}, store?: ConfigStore): Promise<void>;
|
|
10
|
+
export declare function handleIdentityUse(id: string, store?: ConfigStore): Promise<void>;
|
|
11
|
+
export declare function handleIdentityRemove(id: string, store?: ConfigStore): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function handleProviderList(): Promise<void>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ConfigStore } from "@/core/config/config-store";
|
|
2
|
+
export declare function handleRuleList(store?: ConfigStore): Promise<void>;
|
|
3
|
+
export declare function handleRuleAdd(dirPath?: string, identityId?: string, options?: {
|
|
4
|
+
id?: string;
|
|
5
|
+
provider?: string;
|
|
6
|
+
account?: string;
|
|
7
|
+
}, store?: ConfigStore): Promise<void>;
|
|
8
|
+
export declare function handleRuleRemove(idOrPath: string, store?: ConfigStore): Promise<void>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as p from "@clack/prompts";
|
|
2
|
+
export declare function handleCancel(): never;
|
|
3
|
+
export declare function isCancel(value: unknown): boolean;
|
|
4
|
+
export interface PromptOption<T> {
|
|
5
|
+
value: T;
|
|
6
|
+
label?: string;
|
|
7
|
+
hint?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function promptText(options: {
|
|
10
|
+
message: string;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
defaultValue?: string;
|
|
13
|
+
validate?: (value: string) => string | Error | undefined;
|
|
14
|
+
}): Promise<string>;
|
|
15
|
+
export declare function promptSelect<T extends string>(options: {
|
|
16
|
+
message: string;
|
|
17
|
+
options: Array<PromptOption<T>>;
|
|
18
|
+
initialValue?: T;
|
|
19
|
+
}): Promise<T>;
|
|
20
|
+
export declare function promptMultiSelect<T extends string>(options: {
|
|
21
|
+
message: string;
|
|
22
|
+
options: Array<PromptOption<T>>;
|
|
23
|
+
required?: boolean;
|
|
24
|
+
}): Promise<T[]>;
|
|
25
|
+
export declare function promptConfirm(options: {
|
|
26
|
+
message: string;
|
|
27
|
+
active?: string;
|
|
28
|
+
inactive?: string;
|
|
29
|
+
initialValue?: boolean;
|
|
30
|
+
}): Promise<boolean>;
|
|
31
|
+
export { p };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { GitIdentity, ProviderAccount, DirectoryRule } from "@/core/config/schema";
|
|
2
|
+
import type { GitRemoteInfo } from "@/core/git/git-cli";
|
|
3
|
+
export declare function renderIdentitiesTable(identities: GitIdentity[], defaultId: string | null): string;
|
|
4
|
+
export declare function renderAccountsTable(accounts: ProviderAccount[]): string;
|
|
5
|
+
export declare function renderRulesTable(rules: DirectoryRule[]): string;
|
|
6
|
+
export declare function renderRemotesTable(remotes: GitRemoteInfo[]): string;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { PathResolver } from "./path-resolver";
|
|
2
|
+
import { type MainConfig, type GitIdentity, type ProviderAccount, type DirectoryRule, type RepositoryProfile, type GitBridgeSettings } from "./schema";
|
|
3
|
+
export interface CreateIdentityInput {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
email: string;
|
|
7
|
+
signingKey?: string | null;
|
|
8
|
+
isDefault?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface CreateAccountInput {
|
|
11
|
+
id: string;
|
|
12
|
+
providerId: ProviderAccount["providerId"];
|
|
13
|
+
host: string;
|
|
14
|
+
username: string;
|
|
15
|
+
displayName?: string;
|
|
16
|
+
authType: ProviderAccount["authType"];
|
|
17
|
+
sshKeyPath?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface SaveRepositoryProfileInput {
|
|
20
|
+
path: string;
|
|
21
|
+
identityId?: string;
|
|
22
|
+
remotes?: RepositoryProfile["remotes"];
|
|
23
|
+
safetyHookInstalled?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export declare class ConfigStore {
|
|
26
|
+
private paths;
|
|
27
|
+
constructor(paths?: PathResolver);
|
|
28
|
+
getPathResolver(): PathResolver;
|
|
29
|
+
ensureDirectories(): void;
|
|
30
|
+
private atomicWriteJson;
|
|
31
|
+
loadConfig(): MainConfig;
|
|
32
|
+
saveConfig(config: Partial<MainConfig>): MainConfig;
|
|
33
|
+
updateSettings(settings: Partial<GitBridgeSettings>): MainConfig;
|
|
34
|
+
setEnabled(enabled: boolean): MainConfig;
|
|
35
|
+
loadIdentities(): GitIdentity[];
|
|
36
|
+
saveIdentities(identities: GitIdentity[]): void;
|
|
37
|
+
getIdentity(id: string): GitIdentity | undefined;
|
|
38
|
+
addIdentity(identity: CreateIdentityInput): GitIdentity;
|
|
39
|
+
updateIdentity(id: string, updates: Partial<CreateIdentityInput>): GitIdentity;
|
|
40
|
+
removeIdentity(id: string): boolean;
|
|
41
|
+
setDefaultIdentity(id: string): void;
|
|
42
|
+
loadAccounts(): ProviderAccount[];
|
|
43
|
+
saveAccounts(accounts: ProviderAccount[]): void;
|
|
44
|
+
getAccount(id: string): ProviderAccount | undefined;
|
|
45
|
+
addAccount(account: CreateAccountInput): ProviderAccount;
|
|
46
|
+
removeAccount(id: string): boolean;
|
|
47
|
+
loadRules(): DirectoryRule[];
|
|
48
|
+
addRule(rule: DirectoryRule): DirectoryRule;
|
|
49
|
+
removeRule(ruleIdOrPath: string): boolean;
|
|
50
|
+
loadRepositories(): RepositoryProfile[];
|
|
51
|
+
saveRepositories(repositories: RepositoryProfile[]): void;
|
|
52
|
+
getRepository(repoPath: string): RepositoryProfile | undefined;
|
|
53
|
+
saveRepositoryProfile(profile: SaveRepositoryProfileInput): RepositoryProfile;
|
|
54
|
+
removeRepositoryProfile(repoPath: string): boolean;
|
|
55
|
+
}
|
|
56
|
+
export declare const defaultConfigStore: ConfigStore;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare class PathResolver {
|
|
2
|
+
private baseDir;
|
|
3
|
+
constructor(customBaseDir?: string);
|
|
4
|
+
getBaseDir(): string;
|
|
5
|
+
getConfigFile(): string;
|
|
6
|
+
getIdentitiesFile(): string;
|
|
7
|
+
getAccountsFile(): string;
|
|
8
|
+
getReposFile(): string;
|
|
9
|
+
getGeneratedDir(): string;
|
|
10
|
+
getMainGitConfigFile(): string;
|
|
11
|
+
getGeneratedSshConfigFile(): string;
|
|
12
|
+
getRulesDir(): string;
|
|
13
|
+
getRuleGitConfigFile(ruleId: string): string;
|
|
14
|
+
getBackupsDir(): string;
|
|
15
|
+
getEncryptedVaultFile(): string;
|
|
16
|
+
getUserGitConfigFile(): string;
|
|
17
|
+
getUserSshConfigFile(): string;
|
|
18
|
+
getUserSshDir(): string;
|
|
19
|
+
}
|
|
20
|
+
export declare const defaultPathResolver: PathResolver;
|