adachsoft/symfony-console-tool
最新稳定版本:v0.3.0
Composer 安装命令:
composer require adachsoft/symfony-console-tool
包简介
README 文档
README
Library providing an AI SPI tool for running Symfony Console commands (run) and listing available commands (list) in external Symfony projects.
Installation
composer require adachsoft/symfony-console-tool
Usage with adachsoft/ai-tool-call (SPI)
Register SymfonyConsoleToolFactory in the AiToolCallFacadeBuilder and configure the tool using ConfigMap:
use AdachSoft\AiToolCall\PublicApi\Builder\AiToolCallFacadeBuilder;
use AdachSoft\AiToolCall\SPI\Collection\ConfigMap;
use AdachSoft\SymfonyConsoleTool\Tool\SymfonyConsoleToolFactory;
$builder = AiToolCallFacadeBuilder::new()
->withSpiFactories([
new SymfonyConsoleToolFactory(),
])
->withToolConfigs([
'symfony_console' => new ConfigMap([
'base_path' => '/path/to/your/symfony/project',
'console_path' => 'bin/console',
'php_binary' => 'php',
'timeout' => 30.0,
]),
]);
$facade = $builder->build();
Then you can call the symfony_console tool via the public API:
use AdachSoft\AiToolCall\PublicApi\Dto\ToolCallRequestDto;
// List commands
$listResult = $facade->callTool(new ToolCallRequestDto(
toolName: 'symfony_console',
parameters: [
'action' => 'list',
],
));
// Run a specific command
$runResult = $facade->callTool(new ToolCallRequestDto(
toolName: 'symfony_console',
parameters: [
'action' => 'run',
'command' => 'cache:clear --env=prod',
],
));
The result payload is an array with the following keys:
exit_code(int) command exit codeoutput(string) STDOUT contentserror_output(string) STDERR contents
Security
console_path is resolved relative to base_path using adachsoft/normalized-safe-path. Any attempt to escape base_path (path traversal) will result in an error and the tool call will fail.
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-02-01