Download the PHP package duanestorey/ai-tools without Composer
On this page you can find all versions of the php package duanestorey/ai-tools. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download duanestorey/ai-tools
More information about duanestorey/ai-tools
Files in duanestorey/ai-tools
Package ai-tools
Short Description Tools for generating AI-friendly project overviews
License MIT
Informations about the package ai-tools
AI Tools
A Composer package for generating AI-friendly project overviews. This tool creates a comprehensive markdown file that provides AI assistants with a complete overview of your project structure and key files, making it easier for AI to understand your codebase context.
Installation
Via Composer
Manual Installation
- Clone this repository
- Run
composer installin the cloned directory - Link the executable to your project's vendor/bin directory
Usage
Basic Usage
After installation, you can generate an AI-friendly overview of your project:
This will create an ai-overview.md file in your project root with:
- Project Information: Details about the detected project type and framework
- Directory Tree: A complete ASCII representation of your project structure (excluding directories and files specified in the configuration)
- Package JSON: Contents of package.json (if exists in your project)
- Composer JSON: Contents of your composer.json file
- README: Contents of your project's README.md file (if exists)
- Git Information: Repository URL, branches, and git configuration
- Environment Variables: Keys from .env files (values omitted for security)
For Laravel projects, additional sections are automatically included:
- Laravel Routes: API and web routes with their controllers
- Database Schema: Table structure extracted from migrations and models
For comprehensive AI analysis, you can also generate a complete overview that includes the full content of all code files:
This will create an ai-overview-all.md file that includes everything in the regular overview plus the full content of all code files in your project (respecting the exclusion settings in your configuration). This is particularly useful when you want to provide a complete view of your codebase to AI tools for deep analysis.
Code Quality Tools
This package includes several tools to maintain code quality:
- Laravel Pint: A PHP code style fixer based on PHP-CS-Fixer
- PHPStan/Larastan: A static analysis tool to find bugs and errors
You can run these tools using the following commands:
Integrating with Build Processes
Composer Scripts
Add the command to your composer.json scripts section for easy execution:
Now you can run composer generate-ai-overview to generate the overview, or it will automatically run as part of your build process when you execute composer build.
CI/CD Integration
Add the overview generation to your CI/CD pipeline to ensure it's always up-to-date:
Git Hooks
You can use Git hooks to automatically generate the overview before commits or pushes:
Configuration
The tool can be configured using a .ai-tools.json file in your project root. To create an example configuration file, run:
This will create a .ai-tools.json file with default settings and add it to your .gitignore file if one exists.
Here's an example configuration file:
Configuration Options
- output_file: The name of the generated overview file (default:
ai-overview.md). When usinggenerate-all, it will create a file with "-all" appended before the extension (e.g.,ai-overview-all.md) - excluded_directories: Directories to exclude from the directory tree, file watching, and code file inclusion when using
generate-all. Supports both simple directory names (e.g.,vendor) and path-based exclusions (e.g.,path/to/directory) - excluded_files: Files to exclude from the directory tree, file watching, and code file inclusion when using
generate-all - directory_tree: Configuration options for the directory tree viewer
- max_depth: Maximum depth to display in the directory tree (default:
4)
- max_depth: Maximum depth to display in the directory tree (default:
- viewers: Enable or disable specific viewers
- code_files: Configuration options for the code files included in
generate-allcommand- extensions: Array of file extensions to include when using the
generate-allcommand. If not specified, default extensions for PHP/Laravel and Ruby on Rails will be used.
- extensions: Array of file extensions to include when using the
How It Works
Project Type Detection
The tool automatically detects the type of project you're working with. Currently, it can identify:
- Laravel Projects: Detected by the presence of artisan file, app/Http/Controllers directory, or Laravel dependencies
- PHP Projects: Any PHP project that isn't a recognized framework
Based on the detected project type, the tool automatically includes framework-specific information in the overview.
Viewer Architecture
The tool uses a plugin-based architecture with "viewers" for different content types. Each viewer is responsible for generating a specific section of the overview file. The current viewers include:
Core Viewers (Always Included)
- ProjectInfoViewer: Provides information about the detected project type, PHP version, and project metadata
- DirectoryTreeViewer: Generates an ASCII representation of your project structure, respecting excluded directories/files and max depth settings
- ComposerJsonViewer: Includes the contents of your composer.json file
- PackageJsonViewer: Includes the contents of your package.json file (if present)
- ReadmeViewer: Includes the contents of your README.md file (if present)
- GitInfoViewer: Shows Git repository information including repository URL and branches
- EnvVariablesViewer: Shows environment variable keys from .env files (values omitted for security)
Framework-Specific Viewers
Laravel Viewers (Only included for Laravel projects):
- RoutesViewer: Shows API and web routes with their controllers
- SchemaViewer: Extracts database schema from migrations and models
The tool detects changes in your project and only regenerates the overview file when necessary, making it efficient even in watch mode.
Benefits for AI Assistants
When working with AI coding assistants, the ai-overview.md file provides:
- Immediate project structure understanding without requiring multiple queries
- Context about dependencies and project configuration
- Access to your project's documentation
This helps AI assistants provide more accurate and contextually relevant assistance from the start of your conversation.
Extending the Tool
You can extend the tool with custom viewers by implementing the ViewerInterface. This allows you to include additional project information that might be helpful for AI assistants.
License
MIT
All versions of ai-tools with dependencies
symfony/console Version *
symfony/finder Version *
symfony/filesystem Version *
symfony/process Version *