Search by

adachsoft / code-operations-contracts

Arkadiusz Adach

Shared contracts and value objects for language-specific code operation integrations.

Package info

gitlab.com/a.adach/code-operations-contracts

Issues

pkg:composer/adachsoft/code-operations-contracts

Statistics

Installs: 50

Dependents: 5

Suggesters: 0

Stars: 0

v0.2.0 2026-12-01 21:26 UTC

This package is auto-updated.

Last update: 2026-12-01 20:27:35 UTC


README

A PHP 8.3+ contract library for language-specific code-operation packages used by AiDevTeam agents. It defines common interfaces and immutable value objects for validating, testing and running projects while keeping language-specific execution in separate packages.

Requirements

  • PHP 8.3 or later.
  • Composer.

Installation

composer require adachsoft/code-operations-contracts

Contracts

CodeOperationsInterface exposes project support checks, validation, tests, target execution and runtime discovery. Results contain the resolved runtime, exit code, combined output, duration and typed diagnostics. RuntimeResolverInterface defines runtime discovery and selection.

This package contains contracts only. It does not start processes or implement language-specific operations.

Usage

An agent writes its changes to project files first, then passes the project and requested runtime to an implementation:

<?php

use AdachSoft\CodeOperationsContracts\CodeOperationsInterface;
use AdachSoft\CodeOperationsContracts\ExecutionContextDto;
use AdachSoft\CodeOperationsContracts\RuntimeVo;

/** @var CodeOperationsInterface $operations */
$result = $operations->test(
    new ExecutionContextDto('/abs/project', new RuntimeVo('go', '1.23')),
    'TestDisk',
);

The second argument to test() is an optional test filter. run() accepts a target and a list of string arguments. ExecutionContextDto can also limit an operation to relative project paths and set a timeout and additional environment variables.

Runtime selection

A RuntimeVo version may be an exact version or prefix, such as 8.3, 1.23 or 1.23.4. A null version means the resolver should use the version required by the project. If the execution context has no explicit runtime, the resolver selects the project's required version or, when none is declared, the newest available runtime.

Implementations may read requirements from their language's project metadata, for example:

  • PHP: require.php in composer.json.
  • Go: the go and toolchain directives in go.mod.
  • Node.js: engines.node in package.json.

Source safety

Code-operation implementations must not modify project source files. Validation, tests and target execution operate on the project as provided by the agent.

Implementations