Diffinery

codician/diffinerypublic

Open-source, agent-first GitHub and GitHub Actions alternative that runs on your own Cloudflare account: git hosting, pull requests, code review and drop-in GitHub Actions YAML on Workers, Durable Objects, R2 and Containers.

106 lines · 3.1 KBRaw History
1// The parts of VS Code's built-in Git extensions' APIs this extension uses (vscode.git and vscode.git-base,
2// version 1). Declared here rather than copied whole: only these members are relied on.
3import type { Disposable, Event, ProviderResult, Uri } from "vscode";
4
5export interface RemoteSource {
6 readonly name: string;
7 readonly description?: string;
8 readonly detail?: string;
9 /** Codicon name. */
10 readonly icon?: string;
11 readonly url: string | string[];
12}
13
14export interface RemoteSourceAction {
15 readonly label: string;
16 /** Codicon name. */
17 readonly icon: string;
18 run(branch: string): void;
19}
20
21export interface RemoteSourceProvider {
22 readonly name: string;
23 /** Codicon name. */
24 readonly icon?: string;
25 readonly label?: string;
26 readonly placeholder?: string;
27 readonly supportsQuery?: boolean;
28 getBranches?(url: string): ProviderResult<string[]>;
29 getRemoteSourceActions?(url: string): ProviderResult<RemoteSourceAction[]>;
30 getRemoteSources(query?: string): ProviderResult<RemoteSource[]>;
31}
32
33export interface PickRemoteSourceOptions {
34 readonly providerLabel?: (provider: RemoteSourceProvider) => string;
35 readonly urlLabel?: string | ((url: string) => string);
36 readonly providerName?: string;
37 readonly title?: string;
38 readonly placeholder?: string;
39 readonly branch?: boolean;
40 readonly showRecentSources?: boolean;
41}
42
43export interface GitBaseAPI {
44 registerRemoteSourceProvider(provider: RemoteSourceProvider): Disposable;
45 pickRemoteSource(options: PickRemoteSourceOptions): Promise<string | { url: string; branch?: string } | undefined>;
46}
47
48export interface GitBaseExtension {
49 readonly enabled: boolean;
50 readonly onDidChangeEnablement: Event<boolean>;
51 getAPI(version: 1): GitBaseAPI;
52}
53
54export interface Credentials {
55 readonly username: string;
56 readonly password: string;
57}
58
59export interface CredentialsProvider {
60 getCredentials(host: Uri): ProviderResult<Credentials>;
61}
62
63export interface Remote {
64 readonly name: string;
65 readonly fetchUrl?: string;
66 readonly pushUrl?: string;
67 readonly isReadOnly: boolean;
68}
69
70export interface Branch {
71 readonly name?: string;
72 readonly commit?: string;
73 readonly upstream?: { readonly remote: string; readonly name: string };
74}
75
76export interface RepositoryState {
77 readonly HEAD: Branch | undefined;
78 readonly remotes: Remote[];
79}
80
81export interface Repository {
82 readonly rootUri: Uri;
83 readonly state: RepositoryState;
84 addRemote(name: string, url: string): Promise<void>;
85 push(remoteName?: string, branchName?: string, setUpstream?: boolean): Promise<void>;
86}
87
88export interface RemoteSourcePublisher {
89 readonly name: string;
90 /** Codicon name. */
91 readonly icon?: string;
92 publishRepository(repository: Repository): Promise<void>;
93}
94
95export interface GitAPI {
96 readonly git: { readonly path: string };
97 readonly repositories: Repository[];
98 registerCredentialsProvider(provider: CredentialsProvider): Disposable;
99 registerRemoteSourcePublisher(publisher: RemoteSourcePublisher): Disposable;
100}
101
102export interface GitExtension {
103 readonly enabled: boolean;
104 readonly onDidChangeEnablement: Event<boolean>;
105 getAPI(version: 1): GitAPI;
106}