adachsoft / composer-tool
AI tool-call adapter for running Composer operations via adachsoft/composer-lib.
Requires
- php: ^8.3
- adachsoft/ai-tool-call: ^2.0
- adachsoft/collection: ^3.0
- adachsoft/command-executor-lib: ^2.0
- adachsoft/composer-json-fixer: ^0.2 || ^0.3 || ^0.4 || ^0.5
- adachsoft/composer-lib: ^0.7
- adachsoft/gitlib: ^4.0
- adachsoft/normalized-safe-path: ^0.1
Requires (Dev)
- adachsoft/php-code-style: ^0.7
- friendsofphp/php-cs-fixer: ^3.94
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^13.0
- rector/rector: ^2.3
- symplify/phpstan-rules: ^14.9
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
AI tool-call adapter for running Composer operations via
adachsoft/composer-lib, implemented as a SPI tool for
adachsoft/ai-tool-call.
Requirements
- PHP ^8.3
adachsoft/ai-tool-calladachsoft/composer-libadachsoft/command-executor-libadachsoft/normalized-safe-path
Installation
composer require adachsoft/composer-tool
Tools
Each tool has a dedicated reference document containing its request
parameters, result payload, factory configuration, defaults, and monorepo
package_path behavior.
Composer operations
composer- executes Composer operations such as install, update, require, validate, and run scripts.composer_script- lists and runs scripts fromcomposer.json.
Dependency inspection
package_version_check- checks the installed version and declarations of one package.dependency_list- listsrequireandrequire-devdependencies.
Both dependency inspection factories read working_directory from the
ConfigMap passed to each create() call. A single factory instance can
therefore create tools for different working directories. Paths returned by
these tools are relative to the configured working directory and do not expose
absolute filesystem paths.
composer.json operations
composer_json_file- reads and writescomposer.json.composer_json_read- readscomposer.json.composer_json_write- writescomposer.json.composer_json_fix- validates and fixescomposer.json.
Minimal usage
use AdachSoft\AiToolCall\PublicApi\Builder\AiToolCallFacadeBuilder;
use AdachSoft\AiToolCall\SPI\Collection\ConfigMap;
use AdachSoft\ComposerTool\Tool\ComposerToolFactory;
$facade = AiToolCallFacadeBuilder::new()
->withSpiFactories([
new ComposerToolFactory(),
])
->withToolConfigs([
'composer' => new ConfigMap([
'working_directory' => __DIR__,
]),
])
->build();
See the dedicated tool documentation for complete registration examples and configuration options.
Architecture decisions
Versioning
This package follows Semantic Versioning and is versioned exclusively through
Git tags. The composer.json file intentionally does not contain an explicit
version field.
License
MIT