Search by

adachsoft / project-map-tool

Arkadiusz Adach

AI tool adapter for hierarchical project maps

Package info

gitlab.com/a.adach/project-map-tool

Issues

pkg:composer/adachsoft/project-map-tool

Statistics

Installs: 6

Dependents: 0

Suggesters: 0

Stars: 0

v0.1.0 2026-11-28 20:47 UTC

This package is auto-updated.

Last update: 2026-11-28 19:47:41 UTC


README

project-map-tool is an AI tool adapter for hierarchical project maps. It exposes a bounded, operation-based tool (project_map) that agents can use to read and maintain a structured view of a repository: its modules, components, configuration, tests, and documentation, together with the responsibilities and relationships that matter for a task.

The adapter builds on top of adachsoft/project-map, applies adachsoft/file-tool-security-policy to every file-related operation, and implements the tool SPI defined by adachsoft/ai-tool-call.

Capabilities

  • Summary and discovery — check whether a map exists, locate the index, and list available maps.
  • Map reading — read a selected map or the whole index as structured data.
  • Map maintenance — create or update verified nodes (upsert_node) and remove obsolete ones (remove_node), with automatic map bootstrapping for new maps.
  • Validation — validate a single map or all maps after changes.
  • Security — every node path is checked against configurable path, extension, and forbidden-pattern policies before any operation touches the file system.
  • Operation allowlist — restrict the tool to a subset of operations per agent via configuration.

Supported operations: get_summary, read_index, read_map, upsert_node, remove_node, validate_map, validate_all.

Requirements

  • PHP 8.3 or higher.
  • Composer for dependency management.

The adapter requires the following Composer packages (resolved automatically):

PackageVersion
adachsoft/ai-tool-call^1.0 \|\| ^2.0
adachsoft/file-tool-security-policy^1.0
adachsoft/project-map^0.1.0

Installation

composer require adachsoft/project-map-tool

Usage

Create the tool through ProjectMapToolFactory, configure it with your project root, and either register it with your AI tool runtime or invoke it directly with ToolCallRequestDto:

<?php

use AdachSoft\AiToolCall\SPI\Collection\ConfigMap;
use AdachSoft\AiToolCall\SPI\Collection\KeyValueMap;
use AdachSoft\AiToolCall\SPI\Dto\ToolCallRequestDto;
use AdachSoft\ProjectMapTool\Factory\ProjectMapToolFactory;

$factory = new ProjectMapToolFactory();
$tool = $factory->create(new ConfigMap([
    'project_base_path' => '/absolute/path/to/project',
]));

// Direct invocation, e.g. reading the project map summary:
$request = new ToolCallRequestDto(
    toolName: 'project_map',
    parameters: new KeyValueMap(['operation' => 'get_summary']),
);

$result = $tool->callTool($request);
$payload = $result->result->toArray();

See the usage guide for the recommended agent workflow, and examples for integration and direct-invocation samples.

composer require adachsoft/project-map-tool

Integration

Create a configured tool through ProjectMapToolFactory and register it with your AI tool runtime:

<?php

use AdachSoft\AiToolCall\SPI\Collection\ConfigMap;
use AdachSoft\ProjectMapTool\Factory\ProjectMapToolFactory;

$factory = new ProjectMapToolFactory();

$tool = $factory->create(new ConfigMap([
    'project_base_path' => '/absolute/path/to/project',
    // Defaults:
    // 'maps_relative_directory' => 'docs/project-map',
    // 'max_description_length' => 400,
    // 'allowed_operations' => null, // null allows all operations
]));

Required configuration:

KeyTypeDescription
project_base_pathstringAbsolute path to the project root.

Optional configuration:

KeyTypeDefaultDescription
maps_relative_directorystringdocs/project-mapProject-relative directory that stores map files.
allowed_operationslist | nullnull (all)Allowlist of enabled operations.
max_description_lengthint400Maximum node description length.
allowed_path_patternslist | nullnullPath patterns allowed by the security policy.
forbidden_path_patternslist | nullnullPath patterns forbidden by the security policy.
allowed_extensionslist | nullnullFile extensions allowed by the security policy.
forbidden_extensionslist | nullnullFile extensions forbidden by the security policy.

The returned tool implements the AdachSoft\AiToolCall\SPI\ToolInterface contract, so you can register it with any runtime that consumes that SPI:

$toolDefinition = $tool::getDefinition(); // static tool definition for the runtime

Documentation

  • Usage guide — recommended agent workflow for working with project maps.
  • Examples — integration and direct-invocation examples.

License

MIT