MCPcopy Index your code
hub / github.com/opactorai/Claudable / createRepository

Function createRepository

lib/services/github.ts:97–123  ·  view source on GitHub ↗
(options: CreateRepoOptions)

Source from the content-addressed store, hash-verified

95}
96
97export async function createRepository(options: CreateRepoOptions) {
98 const token = await getPlainServiceToken('github');
99 if (!token) {
100 throw new GitHubError('GitHub token not configured', 401);
101 }
102
103 const payload = {
104 name: options.repoName,
105 description: options.description ?? '',
106 private: options.private ?? false,
107 auto_init: false,
108 };
109
110 try {
111 const repo = await githubFetch(token, '/user/repos', {
112 method: 'POST',
113 body: JSON.stringify(payload),
114 });
115
116 return repo as any;
117 } catch (error) {
118 if (error instanceof GitHubError && error.status === 422) {
119 throw new GitHubError(`Repository name "${options.repoName}" is unavailable or already exists.`, error.status);
120 }
121 throw error;
122 }
123}
124
125function resolveProjectRepoPath(projectId: string, repoPath?: string | null) {
126 if (repoPath) {

Callers 2

POSTFunction · 0.90
connectProjectToGitHubFunction · 0.85

Calls 2

getPlainServiceTokenFunction · 0.90
githubFetchFunction · 0.85

Tested by

no test coverage detected