Search by

adachsoft / file-summary-tool

Arkadiusz Adach

file-summary-tool

Package info

gitlab.com/a.adach/file-summary-tool

Issues

pkg:composer/adachsoft/file-summary-tool

Statistics

Installs: 8

Dependents: 0

Suggesters: 0

Stars: 0

v0.2.1 2026-10-01 11:56 UTC

This package is not auto-updated.

Last update: 2026-10-01 10:44:38 UTC


README

file-summary-tool provides an SPI tool that returns a concise or detailed summary of one file inside a configured base directory. Small files can be returned directly without an AI request, while larger files are summarized by an isolated agent.

Installation

composer install

Configuration

Create a ConfigMap with these values:

  • base_path — existing directory used as the sandbox root.
  • api_key — provider credential.
  • provider_id — configured AI provider identifier.
  • model_id — model identifier.
  • allowed_files / forbidden_files — optional file path policy lists.
  • allow_extensions / deny_extensions — optional extension policy lists.
  • max_file_size_bytes — optional positive limit, default 65536.
  • timeout_seconds — optional positive timeout, default 60.
  • direct_read_threshold_bytes — optional non-negative threshold for returning file contents directly, default 2048.
  • cache_dir — optional directory for filesystem summary cache.
  • cache_enabled — optional boolean that enables summary caching, default true.

The tool exposes a required path parameter and an optional detail_level parameter with the values concise and detailed. Paths are resolved through the sandbox contract, checked by the security policy, and read with text encoding only. Project context is not passed to the isolated agent. Markdown and PHP files use format-specific summary instructions, with a generic fallback for other file types.

Usage

use AdachSoft\FileSummaryTool\FileSummaryToolFactory;
use AdachSoft\AiToolCall\SPI\Collection\ConfigMap;

$tool = new FileSummaryToolFactory()->create(new ConfigMap([
    'base_path' => __DIR__ . '/documents',
    'api_key' => $apiKey,
    'provider_id' => 'openai/responses',
    'model_id' => 'gpt-4.1-mini',
    'direct_read_threshold_bytes' => 2048,
    'cache_enabled' => true,
]));

Development

composer test
composer stan
composer test:e2e
composer stan
composer cs:check

Release

See CHANGELOG.md for the release history.