MCPcopy Create free account
hub / github.com/Noumena-Network/code / getSessionRepoRef

Function getSessionRepoRef

src/utils/teleport/api.ts:397–423  ·  view source on GitHub ↗
(sessionContext: {
  sources: SessionContextSource[]
})

Source from the content-addressed store, hash-verified

395}
396
397export function getSessionRepoRef(sessionContext: {
398 sources: SessionContextSource[]
399}): { owner: string; name: string } | null {
400 const gitSource = getGitSourceFromSessionContext(sessionContext)
401 if (gitSource?.url) {
402 const repoPath = parseGitHubRepository(gitSource.url)
403 if (repoPath) {
404 const [owner, name] = repoPath.split('/')
405 if (owner && name) {
406 return { owner, name }
407 }
408 }
409 }
410
411 const workspaceSource =
412 getNoumenaWorkspaceSourceFromSessionContext(sessionContext)
413 if (!workspaceSource) {
414 return null
415 }
416
417 const [owner, name] = workspaceSource.repo.split('/')
418 if (!owner || !name) {
419 return null
420 }
421
422 return { owner, name }
423}
424
425export function getSessionRepoDisplay(sessionContext: {
426 sources: SessionContextSource[]

Callers 1

Tested by

no test coverage detected