ineersa/ai-index

AI index for Symfony projects with map, callgraph and wiring information.

Maintainers

Package info

github.com/ineersa/ai-index

pkg:composer/ineersa/ai-index

Statistics

Installs: 7

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.2 2026-04-22 22:46 UTC

This package is auto-updated.

Last update: 2026-04-22 22:47:11 UTC


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.md section 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:

  1. generates callgraph via PHPStan call-graph config,
  2. exports DI wiring map,
  3. regenerates class docs indexes,
  4. regenerates namespace indexes (unless --skip-namespace).

Outputs:

  • var/reports/di-wiring.toon
  • src/**/docs/*.toon
  • src/**/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, generate aborts with error.
  • callGraph.includeVendorEdges is false by default.
  • generate and wiring:export need a bootable Symfony kernel in the target project unless --skip-wiring is used.
  • vendor/bin/ai-index is a Composer-generated proxy. The ../ineersa/ai-index/bin/ai-index path 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