adachsoft / cs-fixer-tool
AI tool-call compatible php-cs-fixer runner with safe path normalization and command executor integration.
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Forks: 0
pkg:composer/adachsoft/cs-fixer-tool
Requires
- php: >=8.2
- adachsoft/ai-tool-call: ^2.0.1
- adachsoft/command-executor-lib: ^2.0.0
- adachsoft/normalized-safe-path: v0.1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.89
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^12.4
- rector/rector: ^2.3.3
This package is not auto-updated.
Last update: 2026-02-11 04:35:23 UTC
README
AI tool-call compatible php-cs-fixer runner for PHP code style checking and fixing. It integrates with the adachsoft/ai-tool-call SPI, uses normalized safe paths to protect against path traversal, and executes commands via adachsoft/command-executor-lib.
Installation
composer require adachsoft/cs-fixer-tool
Requirements
- PHP >= 8.2
adachsoft/ai-tool-call>= 2.0.1adachsoft/command-executor-lib>= 2.0.0adachsoft/normalized-safe-path>= 0.1.0php-cs-fixeravailable in your environment (typicallyvendor/bin/php-cs-fixer)
Integration with AiToolCall
Register the CS Fixer tool factory in your AiToolCallFacade builder:
use Adachsoft\CsFixerTool\Tool\CsFixerToolFactory;
use AdachSoft\AiToolCall\SPI\Collection\ConfigMap;
$builder->registerToolFactory(new CsFixerToolFactory(), new ConfigMap([
'base_path' => '/var/www/project',
'php_cs_fixer_path' => 'vendor/bin/php-cs-fixer',
'default_timeout' => 300, // optional, default: 300 seconds
'max_output_length' => 10000, // optional, default: 10000 chars
'sanitize_base_path' => true // optional, default: true
]));
base_path defines the root directory for all tool operations. All user-provided paths are resolved relative to this base and validated using normalized safe paths.
Tool Usage
The tool is exposed to the AI agent as run_php_cs_fixer.
Dry run (check only)
{
"toolName": "run_php_cs_fixer",
"parameters": {
"path": "src/Service/MyService.php",
"fix": false
}
}
Apply fixes
{
"toolName": "run_php_cs_fixer",
"parameters": {
"path": "src/Service/MyService.php",
"fix": true
}
}
The result contains:
commandthe executed command string,exitCodeprocess exit code,stdoutsanitized standard output,stderrsanitized standard error output,successboolean indicating success,cwdworking directory for the executed command.