Skip to main content
Glama

run_webasyst_cli

Execute Webasyst CLI commands to manage apps, plugins, themes, and configurations for framework projects.

Instructions

Выполнить CLI команду Webasyst

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandYesCLI команда для выполнения
argsNoАргументы команды

Implementation Reference

  • The core handler function that implements the 'run_webasyst_cli' tool logic. It finds the Webasyst root directory, spawns a PHP process to run cli.php with the provided command and arguments, captures stdout and stderr, and returns the output or throws an error if the process fails.
    async function runWebasystCliTool({ command, args = [] }) { const rootPath = await findWebasystRoot(); const cliPath = path.join(rootPath, 'cli.php'); if (!(await fileExists(cliPath))) throw new Error('CLI файл не найден'); return new Promise((resolve, reject) => { const child = spawn('php', [cliPath, command, ...args], { cwd: rootPath, stdio: 'pipe' }); let output = ''; let error = ''; child.stdout.on('data', d => (output += d.toString())); child.stderr.on('data', d => (error += d.toString())); child.on('close', (code) => { if (code !== 0) reject(new Error(`CLI команда завершилась с кодом ${code}: ${error}`)); else resolve({ content: [{ type: 'text', text: `Результат выполнения команды "${command}":\n\n${output}` }] }); }); }); }
  • Registration of the 'run_webasyst_cli' tool in the ListTools response, including its description and input schema definition.
    { name: 'run_webasyst_cli', description: 'Выполнить CLI команду Webasyst', inputSchema: { type: 'object', properties: { command: { type: 'string', description: 'CLI команда для выполнения' }, args: { type: 'array', items: { type: 'string' }, description: 'Аргументы команды', default: [] } }, required: ['command'] } },
  • Registration of the tool handler in the CallToolRequestSchema switch statement, mapping the tool name to its execution.
    case 'run_webasyst_cli': return await runWebasystCliTool(args);
  • Helper function used by the tool to locate the Webasyst root directory by searching upwards for index.php and wa-system.
    async function findWebasystRoot(startCwd = process.cwd()) { let currentDir = startCwd; while (currentDir !== '/') { const indexPath = path.join(currentDir, 'index.php'); const systemPath = path.join(currentDir, 'wa-system'); try { await fs.access(indexPath); await fs.access(systemPath); return currentDir; } catch { currentDir = path.dirname(currentDir); } } throw new Error('Корневая директория Webasyst не найдена'); }
  • Helper utility function used to check if the CLI file exists before spawning the process.
    async function fileExists(p) { try { await fs.access(p); return true; } catch { return false; } }

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/emmy-design/webasyst-mcp'

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