remcode
Version:
Turn your AI assistant into a codebase expert. Intelligent code analysis, semantic search, and software engineering guidance through MCP integration.
136 lines (135 loc) • 4.3 kB
TypeScript
import { GitHubClient } from './client';
export interface RepositoryPermissions {
admin: boolean;
maintain: boolean;
push: boolean;
triage: boolean;
pull: boolean;
}
export interface Repository {
id: number;
node_id: string;
name: string;
full_name: string;
private: boolean;
owner: {
login: string;
id: number;
avatar_url: string;
url: string;
html_url: string;
};
html_url: string;
description: string | null;
fork: boolean;
url: string;
created_at: string;
updated_at: string;
pushed_at: string;
homepage: string | null;
size: number;
stargazers_count: number;
watchers_count: number;
language: string | null;
forks_count: number;
open_issues_count: number;
default_branch: string;
permissions?: RepositoryPermissions;
}
export interface RepositoryBranch {
name: string;
commit: {
sha: string;
url: string;
};
protected: boolean;
protection?: any;
}
export interface RepositoryContributor {
login: string;
id: number;
avatar_url: string;
html_url: string;
contributions: number;
}
export interface CreateRepositoryOptions {
name: string;
description?: string;
homepage?: string;
private?: boolean;
has_issues?: boolean;
has_projects?: boolean;
has_wiki?: boolean;
auto_init?: boolean;
gitignore_template?: string;
license_template?: string;
allow_squash_merge?: boolean;
allow_merge_commit?: boolean;
allow_rebase_merge?: boolean;
delete_branch_on_merge?: boolean;
}
export interface ForkRepositoryOptions {
organization?: string;
name?: string;
default_branch_only?: boolean;
}
export declare class GitHubRepository {
private client;
constructor(client: GitHubClient);
/**
* Validate if a repository exists and is accessible
*/
validateRepository(owner: string, repo: string): Promise<boolean>;
/**
* Get detailed repository information
*/
getRepositoryInfo(owner: string, repo: string): Promise<Repository>;
/**
* Create a new repository
*/
createRepository(options: CreateRepositoryOptions): Promise<Repository>;
/**
* List repositories for the authenticated user
*/
listUserRepositories(type?: 'all' | 'owner' | 'public' | 'private' | 'member', sort?: 'created' | 'updated' | 'pushed' | 'full_name', direction?: 'asc' | 'desc', perPage?: number, page?: number): Promise<Repository[]>;
/**
* List repositories for a specific organization
*/
listOrganizationRepositories(org: string, type?: 'all' | 'public' | 'private' | 'forks' | 'sources' | 'member', sort?: 'created' | 'updated' | 'pushed' | 'full_name', direction?: 'asc' | 'desc'): Promise<Repository[]>;
/**
* Fork a repository
*/
forkRepository(owner: string, repo: string, options?: ForkRepositoryOptions): Promise<Repository>;
/**
* List branches for a repository
*/
listBranches(owner: string, repo: string, protected_only?: boolean): Promise<RepositoryBranch[]>;
/**
* Get a specific branch
*/
getBranch(owner: string, repo: string, branch: string): Promise<RepositoryBranch>;
/**
* Create a new branch
*/
createBranch(owner: string, repo: string, branchName: string, sha: string): Promise<void>;
/**
* List contributors for a repository
*/
listContributors(owner: string, repo: string, includeAnonymous?: boolean): Promise<RepositoryContributor[]>;
/**
* Create or update a file in a repository
*/
createOrUpdateFile(owner: string, repo: string, path: string, message: string, content: string, branch?: string, sha?: string): Promise<any>;
/**
* Delete a file from a repository
*/
deleteFile(owner: string, repo: string, path: string, message: string, sha: string, branch?: string): Promise<any>;
/**
* Get repository contents
*/
getContents(owner: string, repo: string, path?: string, ref?: string): Promise<any>;
/**
* Add collaborator to a repository
*/
addCollaborator(owner: string, repo: string, username: string, permission?: 'pull' | 'push' | 'admin' | 'maintain' | 'triage'): Promise<any>;
}