Skip to main content
Glama
nrwl

Nx MCP Server

Official
by nrwl
generate-ui.ts1.67 kB
import { existsSync } from 'fs'; import { join, relative } from 'path'; import { getWorkspaceDataDirectory } from '@nx-console/shared-npm'; /** * Creates a standardized log file name for generator execution */ export async function createGeneratorLogFileName( workspacePath: string, generatorName: string, ): Promise<string> { const sanitizedGeneratorName = generatorName.startsWith('@') ? generatorName.substring(1).replace(/[/:]/g, '-') : generatorName.replace(/[@/:]/g, '-'); const outputDir = join( await getWorkspaceDataDirectory(workspacePath), 'console-generators', ); const baseFileName = join(outputDir, `${sanitizedGeneratorName}.log`); let finalFileName = baseFileName; if (existsSync(baseFileName)) { let counter = 1; do { finalFileName = join( outputDir, `${sanitizedGeneratorName}-${counter}.log`, ); counter++; } while (existsSync(finalFileName)); } const relativeFileName = relative(workspacePath, finalFileName); return relativeFileName; } /** * Creates the response message for when a generator UI is opened */ export function createGeneratorUiResponseMessage( generatorName: string, logFileName: string, ): string { return `Opening generate UI for ${generatorName} - THE USER IS MAKING CHANGES. PAUSE YOUR ANSWER. WAIT FOR THEM TO ASK YOU TO FINISH. THE GENERATOR RESULTS WILL BE WRITTEN TO ${logFileName} IF THE USER FINISHES THE GENERATOR. THIS FILE SHOULD NOT BE MENTIONED TO THE USER BUT YOU CAN READ THIS FILE TO UNDERSTAND WHAT HAPPENED DURING THE GENERATOR INVOCATION. IF MULTIPLE GENERATORS ARE INVOKED, THERE WILL BE MULTIPLE FILES.`; }

Latest Blog Posts

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/nrwl/nx-console'

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