MCPcopy Index your code
hub / github.com/sourcebot-dev/sourcebot / getCodeHostInfoForRepo

Function getCodeHostInfoForRepo

packages/web/src/lib/utils.ts:209–307  ·  view source on GitHub ↗
(repo: {
    codeHostType: CodeHostType,
    name: string,
    displayName?: string,
    externalWebUrl?: string,
})

Source from the content-addressed store, hash-verified

207}
208
209export const getCodeHostInfoForRepo = (repo: {
210 codeHostType: CodeHostType,
211 name: string,
212 displayName?: string,
213 externalWebUrl?: string,
214}): CodeHostInfo => {
215 const { codeHostType, name, displayName, externalWebUrl } = repo;
216
217 switch (codeHostType) {
218 case 'github': {
219 const { src, className } = getCodeHostIcon('github')!;
220 return {
221 type: "github",
222 displayName: displayName ?? name,
223 codeHostName: "GitHub",
224 externalWebUrl,
225 icon: src,
226 iconClassName: className,
227 }
228 }
229 case 'gitlab': {
230 const { src, className } = getCodeHostIcon('gitlab')!;
231 return {
232 type: "gitlab",
233 displayName: displayName ?? name,
234 codeHostName: "GitLab",
235 externalWebUrl,
236 icon: src,
237 iconClassName: className,
238 }
239 }
240 case 'azuredevops': {
241 const { src, className } = getCodeHostIcon('azuredevops')!;
242 return {
243 type: "azuredevops",
244 displayName: displayName ?? name,
245 codeHostName: "Azure DevOps",
246 externalWebUrl,
247 icon: src,
248 iconClassName: className,
249 }
250 }
251 case 'gitea': {
252 const { src, className } = getCodeHostIcon('gitea')!;
253 return {
254 type: "gitea",
255 displayName: displayName ?? name,
256 codeHostName: "Gitea",
257 externalWebUrl,
258 icon: src,
259 iconClassName: className,
260 }
261 }
262 case 'gerrit': {
263 const { src, className } = getCodeHostIcon('gerrit')!;
264 return {
265 type: "gerrit",
266 displayName: displayName ?? name,

Callers 6

PathHeaderFunction · 0.90
RepositoryBadgeFunction · 0.90
FilterPanelFunction · 0.90
CodePreviewPanelFunction · 0.90
RepoActionsDropdownFunction · 0.90
page.tsxFile · 0.90

Calls 1

getCodeHostIconFunction · 0.85

Tested by

no test coverage detected