Skip to main content
Glama

Memory Bank MCP Server

by t3ta
gitUtils.ts1.33 kB
import * as cp from 'child_process'; import * as _vscode from 'vscode'; /** * Gets the current Git branch name for the given workspace folder. * Executes the `git rev-parse --abbrev-ref HEAD` command. * @param workspaceFolderPath The path to the workspace folder. * @returns A promise resolving to the current branch name, or null if not in a git repo or an error occurs. */ export async function getCurrentGitBranch(workspaceFolderPath: string): Promise<string | null> { return new Promise((resolve) => { // Execute git command in the workspace root cp.exec('git rev-parse --abbrev-ref HEAD', { cwd: workspaceFolderPath }, (err, stdout, _stderr) => { if (err) { // エラーをUIに表示するほどではないが、console.warnの代わりに // vscode.window.showWarningMessage('Could not determine current Git branch.'); // のようにUIに表示することも可能 // Don't show error message to user unless necessary, just log warning // vscode.window.showWarningMessage('Could not determine current Git branch.'); resolve(null); // Resolve with null if not a git repo or error return; } const branchName = stdout.trim(); // デバッグ用のログなのでコメントアウト resolve(branchName); }); }); }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/t3ta/memory-bank-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server