UNPKG

@cnbcool/mcp-server

Version:

CNB MCP Server. A comprehensive MCP server that provides seamless integration to the CNB's API(https://cnb.cool), offering a wide range of tools for repository management, pipelines operations and collaboration features

22 lines (21 loc) 592 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getRepoPath = getRepoPath; function getRepoPath(url) { var _a; let repoPath = ''; if (!url) return repoPath; try { const urlObj = new URL(url); // Remove leading / repoPath = urlObj.pathname.substring(1); } catch (_b) { // ssh format address or malformed url repoPath = (_a = url.split(':')[1]) !== null && _a !== void 0 ? _a : ''; } // Remove tailing .git repoPath = repoPath.replace(/\.git$/, ''); return repoPath; }