ineersa / ai-index
AI index for Symfony projects with map, callgraph and wiring information.
Requires
- php: >=8.5
- helgesverre/toon: ^1.0 || ^3.1
- ineersa/call-graph: ^0.1.5
- nikic/php-parser: ^5.7
- phpstan/phpstan: ^2.1
- symfony/console: ^8.0
- symfony/dependency-injection: ^8.0
- symfony/http-kernel: ^8.0
Requires (Dev)
- phpunit/phpunit: ^13.1
README
Standalone AI index tooling for Symfony projects.
It provides a CLI binary (vendor/bin/ai-index) to:
- install agent templates and AGENTS section (
setup) - export Symfony DI wiring metadata (
wiring:export) - generate per-class and namespace AI index files (
generate)
Status
Current status: usable / beta.
Implemented:
- setup recipe (idempotent)
- DI wiring export from compiled Symfony container
- class docs index generation (
src/**/docs/*.toon) - namespace index regeneration (
src/**/ai-index.toon) - mandatory callgraph generation via PHPStan +
ineersa/call-graph
Still recommended before first stable release:
- add unit + integration test suites
- run consumer parity checks in more projects
Installation
From Packagist (normal)
composer require --dev ineersa/ai-index
This package now installs and uses phpstan/phpstan + ineersa/call-graph as runtime dependencies.
Local path dependency (development)
In consumer composer.json:
{
"repositories": [
{
"type": "path",
"url": "packages/ai-index",
"options": { "symlink": true }
}
]
}
Then:
composer require --dev ineersa/ai-index:@dev -W
Quick start
From the Symfony project root:
vendor/bin/ai-index setup vendor/bin/ai-index generate --changed
generate auto-runs wiring export first (parity with the original flow).
For full regeneration:
vendor/bin/ai-index generate --all --force
Commands
setup
Install templates and upsert AGENTS section.
vendor/bin/ai-index setup [--project-root=...] [--dry-run] [--force]
Behavior:
- copies templates:
.agents/skills/ai-index/SKILL.md.agents/index-maintainer.md
- upserts
AGENTS.mdsection between markers:<!-- ai-index:begin --><!-- ai-index:end -->
- idempotent by default
wiring:export
Export DI wiring map as Toon.
vendor/bin/ai-index wiring:export [--project-root=...] [--output=...] [--dry-run]
Default output: var/reports/di-wiring.toon.
generate
Generate class docs + namespace indexes.
vendor/bin/ai-index generate [--project-root=...] [--all|--changed|<targets...>] [--force] [--dry-run] [--skip-wiring] [--skip-namespace]
By default this command:
- generates callgraph via PHPStan call-graph config,
- exports DI wiring map,
- regenerates class docs indexes,
- regenerates namespace indexes (unless
--skip-namespace).
Outputs:
var/reports/di-wiring.toonsrc/**/docs/*.toonsrc/**/ai-index.toon
Configuration (.ai-index.php)
Create this file in the consumer project root to override defaults.
<?php declare(strict_types=1); return [ 'srcDir' => 'src', 'projectNamespacePrefix' => 'App\\', 'callGraph' => [ 'outputPath' => 'callgraph.json', 'phpstanBin' => 'vendor/bin/phpstan', 'configPath' => 'vendor/ineersa/call-graph/callgraph.neon', // false by default: only App<->App edges // true: include App<->Vendor edges too (still excludes Vendor<->Vendor-only edges) 'includeVendorEdges' => false, ], 'wiring' => [ 'outputPath' => 'var/reports/di-wiring.toon', // Either a Kernel class name (recommended): 'kernelFactory' => App\Kernel::class, // or a callable: fn (string $env, bool $debug, string $projectRoot) => KernelInterface 'environment' => 'test', 'debug' => false, 'spec' => 'agent-core.di-wiring/v1', ], 'index' => [ 'spec' => [ 'file' => 'agent-core.file-index/v1', 'namespace' => 'agent-core.ai-docs/v1', ], ], ];
Notes / troubleshooting
- Callgraph is mandatory for
generate. If callgraph config/binary is missing or PHPStan callgraph run fails,generateaborts with error. callGraph.includeVendorEdgesisfalseby default.generateandwiring:exportneed a bootable Symfony kernel in the target project unless--skip-wiringis used.vendor/bin/ai-indexis a Composer-generated proxy. The../ineersa/ai-index/bin/ai-indexpath inside that file is expected.
Development (this package)
composer install composer validate --no-check-publish ./bin/ai-index list --raw ./bin/ai-index setup --dry-run ./bin/ai-index generate --dry-run --skip-wiring ./bin/ai-index wiring:export --dry-run