diff --git a/AGENTS.md b/AGENTS.md index b7a5f29..3a25572 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -76,4 +76,11 @@ symfony console mcp:server - OpenAI GPT-4o-mini default model - ChromaDB on port 8080 - LiveComponents for real-time UI -- Symfony DI and best practices \ No newline at end of file +- Symfony DI and best practices + + +AI Mate Summary: +- Role: MCP-powered, project-aware coding guidance and tools. +- Required action: Read and follow `mate/AGENT_INSTRUCTIONS.md` before taking any action in this project, and prefer MCP tools over raw CLI commands whenever possible. +- Installed extensions: symfony/ai-mate, symfony/ai-monolog-mate-extension, symfony/ai-symfony-mate-extension. + diff --git a/bin/codex b/bin/codex new file mode 100755 index 0000000..cdccf5e --- /dev/null +++ b/bin/codex @@ -0,0 +1,19 @@ +#!/usr/bin/env sh + +set -eu + +SCRIPT_DIR=$(CDPATH= cd -- "$(dirname "$0")" && pwd) +PROJECT_DIR=$(CDPATH= cd -- "$SCRIPT_DIR/.." && pwd) + +if ! command -v codex >/dev/null 2>&1; then + echo "Codex CLI is not installed or not available in PATH." >&2 + echo "Install Codex and try again." >&2 + exit 1 +fi + +cd "$PROJECT_DIR" + +exec codex \ + -c "mcp_servers.symfony_ai_mate_local.command='./vendor/bin/mate'" \ + -c "mcp_servers.symfony_ai_mate_local.args=['serve','--force-keep-alive']" \ + "$@" diff --git a/bin/codex.bat b/bin/codex.bat new file mode 100644 index 0000000..4f42287 --- /dev/null +++ b/bin/codex.bat @@ -0,0 +1,19 @@ +@echo off +setlocal + +set "SCRIPT_DIR=%~dp0" +for %%I in ("%SCRIPT_DIR%..") do set "PROJECT_DIR=%%~fI" + +where codex >nul 2>nul +if errorlevel 1 ( + echo Codex CLI is not installed or not available in PATH. 1>&2 + echo Install Codex and try again. 1>&2 + exit /b 1 +) + +pushd "%PROJECT_DIR%" >nul +codex -c "mcp_servers.symfony_ai_mate_local.command='./vendor/bin/mate'" -c "mcp_servers.symfony_ai_mate_local.args=['serve','--force-keep-alive']" %* +set "CODE=%ERRORLEVEL%" +popd >nul + +exit /b %CODE% diff --git a/mate/AGENT_INSTRUCTIONS.md b/mate/AGENT_INSTRUCTIONS.md new file mode 100644 index 0000000..72df17d --- /dev/null +++ b/mate/AGENT_INSTRUCTIONS.md @@ -0,0 +1,53 @@ +## AI Mate Agent Instructions + +This MCP server provides specialized tools for PHP development. +The following extensions are installed and provide MCP tools that you should +prefer over running CLI commands directly. + +--- + +### Monolog Bridge + +Use MCP tools instead of CLI for log analysis: + +| Instead of... | Use | +|-----------------------------------|------------------------------------| +| `tail -f var/log/dev.log` | `monolog-tail` | +| `grep "error" var/log/*.log` | `monolog-search` with term "error" | +| `grep -E "pattern" var/log/*.log` | `monolog-search-regex` | + +#### Benefits + +- Structured output with parsed log entries +- Multi-file search across all logs at once +- Filter by environment, level, or channel + +--- + +### Symfony Bridge + +#### Container Introspection + +| Instead of... | Use | +|--------------------------------|---------------------| +| `bin/console debug:container` | `symfony-services` | + +- Direct access to compiled container +- Environment-aware (auto-detects dev/test/prod) + +#### Profiler Access + +When `symfony/http-kernel` is installed, profiler tools become available: + +| Tool | Description | +|-----------------------------|--------------------------------------------| +| `symfony-profiler-list` | List profiles with optional filtering | +| `symfony-profiler-latest` | Get the most recent profile | +| `symfony-profiler-search` | Search by route, method, status, date | +| `symfony-profiler-get` | Get profile by token | + +**Resources:** +- `symfony-profiler://profile/{token}` - Full profile with collector list +- `symfony-profiler://profile/{token}/{collector}` - Collector-specific data + +**Security:** Cookies, session data, auth headers, and sensitive env vars are automatically redacted.